简体   繁体   English

Mac Intel:zsh:可执行文件中的错误 CPU 类型:rustup

[英]Mac Intel: zsh: bad CPU type in executable: rustup

I had a Mac with an M1 chip which I backed up on an external HDD.我有一台带有 M1 芯片的 Mac,我在外置硬盘上进行了备份。 I used the backup to setup a Mac with an Intel chip.我使用备份来设置带有 Intel 芯片的 Mac。 When I try to rust rustup I get the following:当我尝试rustup我得到以下信息:

$ rustup
zsh: bad CPU type in executable: rustup

I have tried using the suggestions from this answer to no avail.我尝试使用答案中的建议无济于事。

For reference:以供参考:

$ cat /Users/user/.cargo/config
[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

Any suggestions on how to get rust up and running would be highly appreciated.任何有关如何使 rust 启动和运行的建议都将受到高度赞赏。

As per @Charles Duffy's suggestion I did the following:根据@Charles Duffy 的建议,我做了以下事情:

# Go to generated binaries
cd /Users/<username>/.cargo/bin
# Remove all of them
rm *
# Get a fresh rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n
# Add Mac Intel to target
rustup target add x86_64-apple-darwin
# Add Mac Intel to toolchain
rustup toolchain install stable-x86_64-apple-darwin
# Set Mac Intel toolchain as default
rustup default stable-x86_64-apple-darwin
# Run rustup update for good measure
rustup update

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM