WindowsmacOSLinux

Where Does Rust Cargo Store Packages?

Cargo home, registry cache and binary paths on Windows, macOS and Linux, and how CARGO_HOME moves them together.

Last updated

Cargo keeps the registry index, cached .crate files, extracted sources and installed binaries under a .cargo home folder. The bin subfolder holds cargo install tools like ripgrep. Rustup toolchains sit apart in .rustup beside it.

CARGO_HOME moves the whole tree at once, and rustup respects RUSTUP_HOME for toolchains. Clearing registry/cache forces redownloads but never touches your project code. Run cargo install --list to see which binaries depend on the bin folder before wiping. Lock files in projects pin the exact versions the cache must serve.

Where Cargo stores this, by platform

Windows
C:\Users\[Username]\.cargo

Binaries live in .cargo\bin, caches in .cargo\registry. Add .cargo\bin to PATH if installed tools report missing after a fresh rustup run.

macOS
~/.cargo

Same layout as Linux. The .rustup sibling holds toolchains and often dwarfs the Cargo cache, so check both when disk runs short.

Linux
~/.cargo

Respects CARGO_HOME when set. Target folders inside each project hold build artifacts separately and usually exceed the shared cache.

Frequently asked questions

How do I free space from Rust tooling?

Run rustup toolchain list and remove stale ones, clear ~/.cargo/registry/cache, and delete per project target folders. Keep the active toolchain plus its bin entries.

Where do cargo install binaries go?

Into .cargo/bin on every OS. Keep that folder on PATH. Moving CARGO_HOME requires moving bin too or installed commands stop resolving.

Notice an outdated path? Let us know.