Diskzyv0.1
Safe to delete

What is ~/.cargo/registry on Mac? Is it safe to delete?

Short answer

Yes, ~/.cargo/registry is safe to delete. It holds the registry index and downloaded crates, and Cargo fetches whatever a project needs the next time you build.

Where it is

~/.cargo/registry

What it is

Cargo, the Rust package manager, keeps three things in ~/.cargo/registry: the index of available crates, a cache folder with the compressed .crate files it downloaded, and a src folder with those crates unpacked for the compiler.

It grows as your projects use more crates and more versions of them. The unpacked sources in src usually take more space than the compressed downloads.

Compiled output is not stored here. That lives in each project's target folder, which is often much larger.

How big it gets

Typically hundreds of MB to a few GB.

How to clear it by hand

  1. Make sure no cargo build is running.
  2. Run the command below. It deletes the downloaded crates and their unpacked sources, and leaves the registry index in place.
  3. Do not delete ~/.cargo/bin, which holds cargo itself and the tools you installed with cargo install.
In Terminal
rm -rf ~/.cargo/registry/cache ~/.cargo/registry/src

What happens afterwards

The next cargo build downloads and unpacks the crates the project needs, so it takes longer and needs a network connection. Your code and installed Rust toolchains are unaffected.

How Diskzy handles it

Diskzy lists the Cargo cache in the Clean up tab and ticks it.

Related guides

See where your Mac's space went

Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.

Try Diskzy for free
Read this in:EnglishEspañolDeutschPortuguêsFrançaisTürkçe日本語