简体   繁体   中英

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. I used the backup to setup a Mac with an Intel chip. When I try to rust rustup I get the following:

$ 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.

As per @Charles Duffy's suggestion I did the following:

# 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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