44

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.

ideasman42
  • 42,413
  • 44
  • 197
  • 320

2 Answers2

81

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
Michael Jungo
  • 31,583
  • 3
  • 91
  • 84
  • 1
    Thanks, was thrown by `install` inferring *toolchain* where `uninstall` doesn't. - reported https://github.com/rust-lang-nursery/rustup.rs/issues/957 – ideasman42 Feb 19 '17 at 02:18
  • 3
    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). – sylvain Sep 17 '20 at 21:47
13

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
Federico
  • 1,925
  • 14
  • 19