Mac folder guide
~/.cargo/registry on Mac: Safe to Delete?
~/.cargo/registry
~/.cargo/registry is where Cargo keeps every crate it has downloaded for your Rust projects. The cache and src folders inside it are safe to delete, and Cargo downloads crates again on the next build. Leave ~/.cargo/bin alone.
What is ~/.cargo/registry on a Mac?
Cargo stores each crate twice: the compressed .crate file in cache and the unpacked source in src. Across many projects and versions that adds up to gigabytes.
~/.cargo/git does the same for dependencies pulled straight from Git. Both are pure download caches.
What’s inside
- index, the registry index
- cache, compressed .crate files
- src, unpacked crate sources
How to clear ~/.cargo/registry safely
- Check the size with the first command below.
- Delete the registry cache and src folders, and ~/.cargo/git/checkouts if it is large.
- Build a project to confirm Cargo downloads what it needs.
du -sh ~/.cargo/registry ~/.cargo/git
rm -rf ~/.cargo/registry/cache ~/.cargo/registry/src
When to keep it
- ~/.cargo/bin, which holds cargo itself and tools you installed
- Offline work: without the cache, builds need a connection
Related guides
Questions people ask
Is it safe to delete ~/.cargo/registry?+
Yes. It is a download cache. Cargo fetches crates again on the next build.
Can I delete the whole ~/.cargo folder?+
No. ~/.cargo/bin holds cargo and the tools you installed with it. Clear registry and git only.
Does this clear my project build folders?+
No. Each project’s target folder is separate. cargo clean inside a project removes that.
See which folders fill your Mac
MacZentra, a disk analyzer and storage cleaner for Mac, scans your disk locally and draws it as a Treemap or Sunburst, so a folder like this one shows up with its real size. Scanning and every visualization are free. Cleaning is a one-time $49.99 purchase, and anything you remove goes to the Trash, so it can be restored.
macOS 13 Ventura or later · Apple silicon