What is the target's name on macOS?

I'm trying to set my linker to lld for a speed improvement similar to the one I got on my Linux machines. The problem is: I don't know the target's name for macOS. I also don't know how to find one, docs nor --help don't mention that.

So, what should I put in place of target.x86_64-unknown-linux-gnu for macOS?

Thank you!

See the Forge for a list of targets. You can also do rustup show.

I think you want x86_64-apple-darwin.

2 Likes

Thank you very much! :pray:

UPDATE: wasn't using the correct machine (was ssh'd in a different one) :see_no_evil:

Strangely, but I see no changes after putting this in ~/.cargo/config.toml:

$ cat ~/.cargo/config.toml
[target.x86_64-apple-darwin]
linker = "/usr/local/opt/llvm/bin/ld.lld"

cargo build won't rebuild anything, as it previously would on Linux

Update: things did change when I've put the config in .cargo/config.toml in project itself, but it errors with different things now. Anyways, that's a separate discussion probably.

Because you have to create file without extension.
~/.cargo/config

No, config.toml is also accepted by Cargo

config.toml is actually now preferred. Dumb me, it was a different (and Linux!) machine :slight_smile: