Cargo registry cache (~/.cargo/registry): safe to delete?
Quit first: cargo
Where it is
~/.cargo/registry/cache~/.cargo/registry/src~/.cargo/git/checkouts
What it is
Cargo, Rust's build tool, stores downloaded .crate archives in registry/cache, unpacks them into registry/src so they can be compiled, and keeps checkouts of git dependencies in git/checkouts. All of this is shared by every Rust project on your Mac.
Why it gets so big
Every crate version any project has ever depended on stays here, both compressed and unpacked. Large dependency trees and frequent updates add up quickly.
Is it safe to delete?
Yes. Cargo re-downloads and unpacks crates on the next build, so that first build needs network access. Installed binaries in ~/.cargo/bin and your Cargo config aren't touched. Wait until no cargo command is running before you clean.
Tip
Each project's target folder usually takes far more space than this cache; running cargo's clean subcommand inside a project you're not actively building removes it.
See how much space it uses
du -sh "$HOME/.cargo/registry/cache" "$HOME/.cargo/registry/src" "$HOME/.cargo/git/checkouts" 2>/dev/nullDelete it by hand
Run in Terminal. Deleting cannot be undone, so check the paths first.
rm -rf "$HOME/.cargo/registry/cache"/*
rm -rf "$HOME/.cargo/registry/src"/*
rm -rf "$HOME/.cargo/git/checkouts"/*