LinuxCommandLibrary

rustup-uninstall

Uninstall Rust language toolchain

TLDR

View documentation for the original command

$ tldr rustup toolchain
copy

SYNOPSIS

rustup uninstall [toolchain...]
Uninstalls one or more specific Rust toolchains.

rustup self uninstall
Uninstalls rustup itself and all associated toolchains and data.

PARAMETERS

toolchain...
    One or more names of the Rust toolchains to be uninstalled (e.g., stable, nightly, 1.60.0).

self
    A special keyword used with `rustup uninstall` to indicate that rustup itself should be uninstalled, not just a specific toolchain.

--no-prompt
    Proceed with uninstallation without asking for confirmation. Useful for scripting.

--force
    An alias for --no-prompt, forcing the uninstallation process.

DESCRIPTION

The rustup-uninstall command, typically invoked as `rustup uninstall`, is a crucial subcommand of the `rustup` toolchain manager for the Rust programming language. Its primary function is to remove installed Rust toolchains from your system. This includes specific versions like stable, beta, nightly, or any custom toolchains you may have installed. More significantly, it also provides the capability to completely uninstall rustup itself, along with all associated Rust installations.

When uninstalling `rustup`, the command performs a thorough cleanup, removing `rustup`'s home directory (usually `~/.rustup`), all downloaded toolchains, and `cargo`'s home directory (usually `~/.cargo`). It also attempts to revert modifications made to your shell's environment variables (like `PATH`) during the initial `rustup` installation. By default, `rustup-uninstall` will prompt for confirmation before performing any destructive actions, acting as a safeguard against accidental data loss. This command is essential for managing disk space or completely removing Rust development environments.

CAVEATS

  • Destructive Operation: Running `rustup self uninstall` will permanently remove all Rust toolchains, `rustup` configuration, and `cargo` caches from your system.
  • Environment Variables: While `rustup` attempts to clean up `PATH` modifications, manual intervention might be required if you have custom shell configurations.
  • Confirmation: By default, the command asks for confirmation. Always review the prompt before proceeding, especially for `self uninstall`.
  • Active Processes: Ensure no Rust-related processes or editors are actively using files within the `~/.rustup` or `~/.cargo` directories during uninstallation to avoid errors.

VERIFYING UNINSTALLATION

After running rustup self uninstall, you can verify its success by opening a new terminal session and trying to execute rustc --version or cargo --version. If the uninstallation was successful, these commands should report 'command not found'.

WHAT GETS REMOVED

When rustup self uninstall is executed, it targets and removes:
- The ~/.rustup directory, which contains all downloaded toolchains and `rustup`'s metadata.
- The ~/.cargo directory, containing `cargo`'s executable, registries, and build caches.
- Entries related to `rustup` and `cargo` from common shell configuration files (e.g., `~/.bashrc`, `~/.zshrc`, `~/.profile`).

HISTORY

`rustup` was created by Alex Crichton and first released in 2016, quickly becoming the official and recommended way to install and manage Rust toolchains across various platforms. The `uninstall` functionality has been a core component since its early development, providing users with a robust method to clean up or remove Rust environments, reflecting `rustup`'s commitment to manageability and user control over their development setup.

SEE ALSO

Copied to clipboard