Goodbye, Rust? Or just "see you later"?
\nYou installed Rust via rustup — tried it, experimented, wrote a couple of programs. But a developer's life is unpredictable: maybe the project moved to another stack, or you just want to free up disk space. Or maybe you accidentally broke the toolchain and decided to start from scratch. Whatever the case, the question "how to remove Rust installed via rustup" is searched thousands of times. And for good reason: the process is not as obvious as uninstalling a regular program.
In this article, we will cover not only the basic command rustup self uninstall, but also dig deeper: how to check what remains after uninstallation, how to remove only a specific compiler version, and what to do if you change your mind and want to restore everything. Get ready: it will be interesting, useful, and include real code examples.
What is rustup and why uninstalling it is not "just delete a folder"?
\nBefore pressing Delete, let's understand what rustup actually is. It is not just a package manager — it is a toolchain installer and manager for Rust. It manages versions of the rustc compiler, the cargo build system, documentation, and the standard library. When you install Rust via rustup, it creates:
- \n
- The
~/.rustupdirectory — all toolchains (stable, nightly, beta) and tools live here. \n - The
~/.cargodirectory — package cache, binaries installed viacargo install, and configuration. \n - Entries in
PATH(usually in~/.bashrc,~/.zshrc, or~/.profile). \n
Simply deleting the ~/.rustup folder will leave garbage behind and may break your terminal. Therefore, the correct approach is to use the built-in rustup tool.
Method #1: Complete uninstallation via rustup self uninstall (recommended)
\nThe simplest and most reliable way is to run the command rustup self uninstall. It will do all the dirty work for you:
rustup self uninstall\nAfter execution, you will see a confirmation dialog:
\nAre you sure you want to uninstall Rust? (y/N) y\ninfo: removing rustup home\ninfo: removing cargo home\ninfo: removing rustup binaries\ninfo: done. Rust has been uninstalled.\nWhat happens under the hood:
\n- \n
- The
~/.rustupfolder with all toolchains is removed. \n - The
~/.cargofolder is removed (note: along with any projects you placed there and installed binaries!). \n - Symlinks to
rustup,rustc,cargoare removed from~/.cargo/bin. \n - The command does not touch shell configuration files (bashrc/zshrc). You need to manually remove the line
source $HOME/.cargo/envorexport PATH="$HOME/.cargo/bin:$PATH". \n
Important: If you installed binaries via cargo install (e.g., ripgrep, bat, fd), they will also be removed. Save their list if you plan to reinstall:
cargo install --list > installed_crates.txt\n\nMethod #2: Removing only a specific toolchain (without fully uninstalling Rust)
\nIf you don't want to remove Rust entirely, but only get rid of a specific version (e.g., an outdated nightly build), use the command rustup toolchain remove:
rustup toolchain remove nightly-2023-01-01\nYou can check which toolchains are installed with:
\nrustup toolchain list\nThe output might look like:
\nstable-x86_64-unknown-linux-gnu (default)\nnightly-x86_64-unknown-linux-gnu\n1.70.0-x86_64-unknown-linu