How to completely remove Rust installed via rustup: a step-by-step guide

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

Goodbye, Rust? Or just "see you later"?

\n

You 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.

\n

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.

\n\n

What is rustup and why uninstalling it is not "just delete a folder"?

\n

Before 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
    \n
  • The ~/.rustup directory — all toolchains (stable, nightly, beta) and tools live here.
  • \n
  • The ~/.cargo directory — package cache, binaries installed via cargo install, and configuration.
  • \n
  • Entries in PATH (usually in ~/.bashrc, ~/.zshrc, or ~/.profile).
  • \n
\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.

\n\n

Method #1: Complete uninstallation via rustup self uninstall (recommended)

\n

The simplest and most reliable way is to run the command rustup self uninstall. It will do all the dirty work for you:

\n
rustup self uninstall
\n

After execution, you will see a confirmation dialog:

\n
Are 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.
\n

What happens under the hood:

\n
    \n
  • The ~/.rustup folder with all toolchains is removed.
  • \n
  • The ~/.cargo folder is removed (note: along with any projects you placed there and installed binaries!).
  • \n
  • Symlinks to rustup, rustc, cargo are 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/env or export PATH="$HOME/.cargo/bin:$PATH".
  • \n
\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:

\n
cargo install --list > installed_crates.txt
\n\n

Method #2: Removing only a specific toolchain (without fully uninstalling Rust)

\n

If 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:

\n
rustup toolchain remove nightly-2023-01-01
\n

You can check which toolchains are installed with:

\n
rustup toolchain list
\n

The output might look like:

\n
stable-x86_64-unknown-linux-gnu (default)\nnightly-x86_64-unknown-linux-gnu\n1.70.0-x86_64-unknown-linu                

Blogs

Book Recommendations