Uninstalling Rust on Arch

Hello I've been doing a little research and I've come across a issue I think others are having as well that I haven't quite been able to find a answer to yet. I just installed Arch Linux BTW, sorry bad joke, and I am using the AUR package installer paru that is built in rust. I installed paru before installing rust and now my system has rust and cargo but not rustup. I already unistalled paru thinking maybe the dependencies would uninstall as well but didn't. If I run the command

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I get a prompt

~ ⟩ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /usr/bin
warning: It is recommended that rustup be the primary Rust installation.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed

Continue? (y/N

in /usr/bin/ I have the following dep

rustc
rust-demangler
rustdoc
rustfmt
rust-gbd
rust-gbdgui
rust-libd
as well as 
cargo 
cargo-clippy
cargo-fmt

I would like to just run the installer and hope everything will be ok but I want to ask here if I should delete everything in /usr/bin/ rust related and then run or what

If a package, e.g. if a paru package you’ve installed, needs the system version of rust installed as a dependency, then it might be okay to just have two rust installations; one as the dependency of your paru, and one for personal use. I’m neither familiar with paru nor Arch and AUR though. But if it’s a dependency of something you’re using, there may be no sane way of uninstalling (or replacing) the Rust that’s used for that.

As the rustup installation script is telling you, after completing your installation, you’ll just need to pay attention to how your PATH ends up being set up; the path to ~/.cargo/bin needs to get priority over /usr/bin, so that running rustc in a terminal chooses the rustup-installed one. (Easy to do a sanity-check by running which rustc after everything is installed. If it doesn’t point to the ~/.cargo/bin/rustc one but to /usr/bin/rustc, then you know you’ll need to look into how to adjust your PATH configuration.)

thank you that's exactly what I am looking into now, after the installation I get a message to set source "$HOME/.cargo/env" which fish shell gives a error for either by running the command in the terminal or adding it to my fish.config. I also tried running it for .cargo/bin
At least we've pinpointed the issue now its a matter of figuring out how to set path

I found my solution in a fish shell path variable stack overflow question environment variables - Modifying PATH with fish shell - Stack Overflow

I would suggest installing rustup using the arch package instead. That package provides rust, so you don't need to install the rust package separately.

2 Likes

Another thing you could do is install paru with your rustup install (cargo install paru), which fixes needing to have two separate rust installs.

You should uninstall your system rust with the package manager though (probably pacman -Rs paru), not by deleting stuff.

1 Like

Some possible downsides / things of note when using cargo install:

  • the default doesn’t use --locked, though of course one can do this … it’s a trade-off I suppose. Up-to-date dependencies even for more slowly maintained software may be a good thing – on the other hand, fewer people may have looked at the code to check if it isn’t doing anything unreasonable. Not using --locked can also sometimes (not very often) mean that a build may fail
  • keeping software installed this way up to date isn’t automatic, and requires extra effort. E.g. via tools such as cargo install-update
  • it’s slower to build things yourself than using a packaged binary
1 Like

First two are definitely true, but the fact that it's depending on rust means that it's building the package already, so there's no difference there.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.