How to uninstall Rust that was installed via rustup?
Asked Answered
V

4

161

I installed Rust on my Ubuntu 16.04 machine through

curl https://sh.rustup.rs -sSf | sh

as can be seen on the Installation Page.

How do I now uninstall Rust?

Velure answered 27/8, 2018 at 19:38 Comment(0)
V
293

To uninstall rustc, rustup and cargo from my Ubuntu 16.04 installation, I did:

rustup self uninstall

and it worked.

Velure answered 27/8, 2018 at 19:38 Comment(4)
This also removes all installed rust programs in $HOME/.cargo/bin. Basically it deletes the whole $HOME/.cargo folder.Buffington
This doesn't work on my arch Linux Arm, error: self-uninstall is disabled for this build of rustup, so you'll have to use package managerMarelda
@0xB00B I mean, the problem goes away if you used a package manager to install rustup in the first place. Uninstalling a package installed via a package manager is trivial. It's a problem if you didn't; lots of distros don't package rustup in a package manager, in which case, self-uninstall is the only way to remove it, because the installation was most likely via the shell fileRenegado
@Renegado stands with Ukraine it wasn't available through package manger in my case.Marelda
S
46

If you pay attention to the message you get while installing, you will find the command you are looking for. It's rustup self uninstall.

Rust uninstall command

Svetlana answered 9/10, 2018 at 17:28 Comment(3)
My installation command doesn't show me this.Clothespin
@ShipluMokaddim I don't remember this screen only when tried to skip interactive part. In one cloud IDE i've got error that "/dev/tty" device not found. Looked into installer script and found that error is related to one question during installation (typical install and something else). Script also contains comment that "-y" argument (as I remember) will skip interactive part and run typical installation. On local devices I've seen it both in windows and linux. Probably you skiped something :DIdeal
@RyoidenshiAokigahara I solved it 3 weeks ago. Don't remember now how. But I think your comment has a good point.Clothespin
H
24

As for Linux based operating systems, the following command can be used:

rustup self uninstall

this will remove all the Rust Compiler, Tool Chains and Data including rustc and cargo If you're one window this should wok, but you have to remove C++ build tools manually if you want to remove it as well, though I would never recommend.

Highflown answered 11/10, 2021 at 4:7 Comment(1)
Works on Mac OSKoehler
S
5

You can do this without manually deleting the old rust binaries by uninstalling cargo and then auto-removing its now un-needed dependencies:

sudo apt remove cargo
sudo apt autoremove
Salmanazar answered 24/1, 2022 at 15:20 Comment(1)
Not sure how this would work if Rust was installed via rustup. This implies both that you're running a Debian-based distro, and that it was installed via apt.Twinscrew

© 2022 - 2024 — McMap. All rights reserved.