How to remove Rust compiler toolchains with Rustup?
Asked Answered
B

2

53

The Rustup documentation shows how to install Rust nightly, but not how to remove it.

While the docs do show how to uninstall rustup entirely, I'd like to keep the stable branch.

How can I uninstall Rust nightly?


Note that I attempted to do the opposite of rustup install nightly...

  • rustup uninstall nightly
  • rustup remove nightly
  • rustup delete nightly

... to no avail.

Even though I read the documentation it wasn't clear that nightly was a toolchain, a channel... or something else.

Brotherson answered 19/2, 2017 at 2:5 Comment(0)
U
92

The command you're looking for is:

rustup toolchain remove nightly

remove and uninstall both work for this.

For more details see:

rustup help toolchain
Unfix answered 19/2, 2017 at 2:16 Comment(2)
Thanks, was thrown by install inferring toolchain where uninstall doesn't. - reported github.com/rust-lang-nursery/rustup.rs/issues/957Brotherson
This does not seem to remove specific toolchains already installed under ~/.rustup/toolchains/ ... Did for i in nightly-*; do rustup toolchain remove ${i/%-x86_64-unknown-linux-gnu}; done. The toolchains were taking a huge amount of space (~36 GB).Procora
K
16

You might have more than one nightly toolchain installed. To list all installed toolchains, run rustup show. The output will look like this:

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/fpoli/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-2018-06-27-x86_64-unknown-linux-gnu
nightly-2021-02-24-x86_64-unknown-linux-gnu
nightly-2021-09-20-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.54.0 (a178d0322 2021-07-26)

Now that you know the installed versions, you can remove them with the following command:

rustup toolchain remove nightly-2018-06-27 nightly-2021-02-24 nightly-2021-09-20
Kidnap answered 1/10, 2021 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.