rustfmt: rustfmt errors out on OSX
Cargo version
$ cargo -V
cargo 0.23.0 (61fa02415 2017-11-22)
Rust version
$ rustc -V
rustc 1.22.1 (05e2e1c41 2017-11-22)
Installed via
cargo +nightly install -f rustfmt-nightly
export DYLD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$DYLD_LIBRARY_PATH
Error
$ rustfmt
dyld: Library not loaded: @rpath/libsyntax-6ee77dfa7d362c52.dylib
Referenced from: /Users/dhanush/.cargo/bin/rustfmt
Reason: image not found
Trace/BPT trap: 5
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 20 (11 by maintainers)
If anyone is still having problems with this issue, I recommend installing rustfmt via rustup (
rustup component add rustfmt-preview). Let me know if there are still issues with the rustup version and I’ll re-open.I’m running into this same issue on Arch.
Reinstalling rustfmt fixed nothing, but reinstalling nightly and then reinstalling rustfmt worked.EDIT: apologies, the above is not true. When testing I ran
cargo fmtfor some reason instead ofrustfmtand I thought it worked, but it just doesn’t output any error and silently fails in that case. I am still having this issue on arch.EDIT: Actually, the above is also only partially true; it appears that cargo fmt did work, however, the second time I tried to run it it did not. I only have one version of rustfmt installed on my system, so I’m not sure why it worked exaclty once and then couldn’t load libsyntax again. I’m having trouble reproducing it again now though.
EDIT: Last edit I hope… tried a few more times an the cargo fmt issue was a red herring and appears to be completely different. cargo fmt is working fine, rustfmt is failing with the error the OP reported.