Skip to content

How to uninstall Rust and rustup on a Mac, and the 2.7 GB it keeps in two hidden folders

rustup removes itself with one command. What it deletes, the 969 MB crate cache that goes with it, and the line it leaves in your shell profile.

5 min read

How do I completely uninstall Rust on a Mac?

If you installed Rust with rustup, the installer from rust-lang.org, run one command in Terminal:

rustup self uninstall

It asks for confirmation, then deletes ~/.rustup (every toolchain) and ~/.cargo (the commands and the crate cache). That is the whole install. Open a new Terminal window afterwards; cargo --version should answer "command not found".

What does Rust keep on a Mac?

WhereSize hereWhat it is
~/.rustup/toolchains1.7 GBThe compiler and standard library, one copy per toolchain
~/.cargo/registry969 MBSource of every crate any project downloaded
~/.cargo/bin11 MBcargo, rustc, rustup and anything you ran cargo install for
~/.zshenv1 lineAdds ~/.cargo/bin to your PATH

On our Mac the one stable toolchain alone was 1.7 GB. Each extra toolchain, nightly or an older pinned version, adds about as much again. rustup toolchain list shows them.

Does rustup self uninstall remove the PATH line?

It tries. The installer adds a line that sources ~/.cargo/env to your shell profile, and on our Mac it sat in ~/.zshenv. If a new Terminal window prints "no such file or directory: ~/.cargo/env", open the profile it names and delete that one line.

grep -n cargo ~/.zshenv ~/.zshrc ~/.zprofile ~/.bash_profile 2>/dev/null

What about Rust installed with Homebrew?

Homebrew's rust formula is a separate copy. brew uninstall rust removes it, and rustup self uninstall does nothing to it. which -a cargo lists every copy on your PATH, so you can tell which one you have before you start.

Do I need to uninstall Rust to get the space back?

Often not. The crate cache and old build folders are the parts that grow. Each project's target folder is not touched by any of the commands above and is usually the biggest of all; see Rust and Cargo taking up space for clearing them while keeping Rust installed.

Find what is left in one look

Free Mac's Dev tab lists Rust build output by project, and the Storage map shows ~/.rustup and ~/.cargo to scale. Anything you pick goes to the Trash. More on hidden folders like these in dot folders taking up space.

Related: uninstall Bun and uninstall Gemini CLI.

Common questions

Does rustup self uninstall delete my Rust projects?

No. It removes ~/.rustup and ~/.cargo only. Your projects, and the target folders inside them, stay where they are.

How much space does Rust take on a Mac?

On our Mac, 2.7 GB: 1.7 GB for one stable toolchain in ~/.rustup and 980 MB in ~/.cargo, nearly all of it the downloaded crate cache. Build folders inside projects come on top.

Is it safe to delete ~/.cargo by hand?

Yes, but use rustup self uninstall instead so ~/.rustup goes too. Deleting ~/.cargo alone leaves the toolchains behind and breaks the rustup command.

Read next