You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustup self remove should not remove ~/.cargo/bin files that it doesn't own #4644
rustup removes the entirety of ~/.cargo/bin. This is frustrating when you've done a few cargo install foo and want to keep the binaries.
I run rustup self remove sometimes when I want to be sure that I'm testing the system rustc version, and it surprised me to lose a bunch of rust binaries that I'd installed.
Steps
Install rustup
cargo install bat
rustup self remove
ls ~/.cargo/bin
Possible Solution(s)
I suggest that rustup only removes the symlinks in ~/.cargo/bin that it originally created. These should be easy to detect.
$ ls -lh ~/.cargo/bin
-rwxr-xr-x 1 wilfred staff 5.6M 3 Dec 10:27 bat*
lrwxr-xr-x 1 wilfred staff 6B 28 Aug 12:27 cargo@ -> rustup
lrwxr-xr-x 1 wilfred staff 6B 28 Aug 12:27 cargo-clippy@ -> rustup
...
Notes
No response
Rustup version
$ rustup --versionrustup 1.28.2 (e4f3ad6f8 2025-04-28)info: This is the version for the rustup toolchain manager, not the rustc compiler.info: The currently active `rustc` version is `rustc 1.92.0 (ded5c06cf 2025-12-08)`
@Wilfredrustup self remove is meant to remove the whole rust installation from your machine and the current assumption is that rustup fully owns ~/.cargo/bin, so I'd say this is working as intended.
The option of removing only the links has already been considered as a part of #247's solution, and the consensus that our team had with the cargo team was that it can be implemented on another directory other than ~/.cargo/bin, say ~/.local/bin (cc @epage).
Activity
rami3l commentedon Dec 15, 2025
@Wilfred
rustup self removeis meant to remove the whole rust installation from your machine and the current assumption is that rustup fully owns~/.cargo/bin, so I'd say this is working as intended.The option of removing only the links has already been considered as a part of #247's solution, and the consensus that our team had with the cargo team was that it can be implemented on another directory other than
~/.cargo/bin, say~/.local/bin(cc @epage).For your particular use case, I'd suggest linking the system toolchain as described in https://rust-lang.github.io/rustup/installation/already-installed-rust.html#set-up-rustup-with-an-existing-rust-toolchain.
ChrisDenton commentedon Dec 15, 2025
We do plan to change this as part of the work to support xdg directories in cargo and rustup
epage commentedon Dec 15, 2025
For notes on the XDG plans, see https://blog.rust-lang.org/inside-rust/2025/10/01/this-development-cycle-in-cargo-1.90/#all-hands-xdg-paths
This issue looks to mostly be a duplicate of #285, see also #285 (comment)
rami3l commentedon Dec 15, 2025
@epage Nice call! Closing…
$CARGO_HOME(~/.cargo) onrustup self uninstall#285