140

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?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
vvvvv
  • 25,404
  • 19
  • 49
  • 81

4 Answers4

255

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

rustup self uninstall

and it worked.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
vvvvv
  • 25,404
  • 19
  • 49
  • 81
  • 4
    This also removes all installed rust programs in `$HOME/.cargo/bin`. Basically it deletes the whole `$HOME/.cargo` folder. – zingi Jun 25 '21 at 07:24
  • 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 manager – 0xB00B Dec 21 '21 at 11:15
  • @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 file – Zoe Nov 03 '22 at 21:37
  • @Zoe stands with Ukraine it wasn't available through package manger in my case. – 0xB00B Nov 04 '22 at 05:05
45

If you pay attention to the message you get while installing, you will find the command you are looking for:

Rust uninstall command

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
MaNKuR
  • 2,578
  • 1
  • 19
  • 31
  • 3
    My installation command doesn't show me this. – Shiplu Mokaddim Feb 09 '21 at 10:14
  • @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 :D – Ryoidenshi Aokigahara Mar 01 '21 at 08:18
  • @RyoidenshiAokigahara I solved it 3 weeks ago. Don't remember now how. But I think your comment has a good point. – Shiplu Mokaddim Mar 01 '21 at 09:34
19

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.

Tushar Singh
  • 209
  • 5
  • 7
6

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
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Aadhil Anwar
  • 127
  • 1
  • 4
  • 4
    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`. – Brian Reading Mar 09 '22 at 05:06