When installing rustup-init 0.14.0 with Homebrew, it fails because it is a relative symlink.
Environment:
$ which rustup-init
/usr/local/bin/rustup-init
$ readlink /usr/local/bin/rustup-init
../Cellar/rustup-init/1.14.0/bin/rustup-init
CARGO_HOME=~/.config/cargo
RUSTUP_HOME=~/.config/rustup
Here is what happens:
$ rm -rf ~/.config/rustup/ ~/.config/cargo/
$ rustup-init -y --no-modify-path
error: failed to set permissions for '~/.config/cargo/bin/rustup'
info: caused by: No such file or directory (os error 2)
After this, rustup is a symlink pointing to the same target as the original symlink, which is wrong.
$ readlink ~/.config/cargo/bin/rustup
../Cellar/rustup-init/1.14.0/bin/rustup-init
If I run the command again, it now tries to symlink from the wrong symlink again.
$ rustup-init -y --no-modify-path
error: could not create link from '../Cellar/rustup-init/1.14.0/bin/rustup-init' to '~/.config/cargo/bin/rustup'
info: caused by: File exists (os error 17)
This is probably an error in utils::current_exe() since it doesn't resolve the path correctly (or at all).
I'm getting the same issue. is there a way to fix it?
I'm getting this:
/usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init -y
error: could not copy file from '/usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init' to '/Users/chris/.cargo/bin/rustup'
info: caused by: No such file or directory (os error 2)
Current installation options:
default host triple: x86_64-apple-darwin
default toolchain: stable
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
error: failed to set permissions for '/Users/[my_user]/.cargo/bin/rustup'
info: caused by: No such file or directory (os error 2)
Same issue. How to fix it?
Version:
brew uninstall rustup
Uninstalling /usr/local/Cellar/rustup-init/1.14.0... (6 files, 8.0MB)
It works for me if I execute the original file /usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init instead of the symlink. Hope it helps
@jjlorenzo: It doesn't work for me.
did you remove ~/.cargo first ?
yeah. when I do that it gives a file does not exist error but still creates the link.
Can confirm, running rustup-init with the fully qualified path fixed the issue:
rm -rf ~/.cargo & /usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init
running rustup-init with the fully qualified path fixed the issue
That doesn't fix the issue, it works around it.
I reckon it's creating a symlink based on invalid assumption, eg:
/Users/my.user/.cargo/bin/rustup@ -> ../Cellar/rustup-init/1.14.0/bin/rustup-init
Absolute of ../Cellar/rustup-init/1.14.0/bin/rustup-init should've been /usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init, but it's been interpreted as /Users/my.user/.cargo/Cellar/rustup-init/1.14.0/bin/rustup-init .
It shouldn't even follow the symlink in this case, since the end result should be $CARGO_HOME/bin/rustup pointing to $(brew --prefix)/bin/rustup-init, not to $(brew --prefix) /Cellar/rustup-init/1.14.0/bin/rustup-init.
Most helpful comment
Can confirm, running rustup-init with the fully qualified path fixed the issue:
rm -rf ~/.cargo & /usr/local/Cellar/rustup-init/1.14.0/bin/rustup-init