manage cargo cache (${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively
open sourceApache-2.0 OR MITself-hostablefree
cargo-cache shows how much space Cargo's home directory (~/.cargo) uses, broken down into installed binaries, registry index, crate archives, source checkouts and git repos, and cleans it selectively: autoclean of checkouts, removing items older or younger than a date, recompressing git repos, or dropping entries not used by a given crate. It can also report sccache cache sizes.
Ways to install
Package managers
Problems it solves
- ~/.cargo is taking up several gigabytes and I don't know what's safe to delete
- clean old crate downloads and git checkouts from the cargo registry
- which crates take the most space in my cargo home
- shrink the cargo registry before caching it in CI
- remove cached crates I haven't used in months
- see how big my sccache directory has grown
- recompress the git dependencies cargo has cloned
- trim the cargo cache to only what one project needs
Features
- size breakdown of ~/.cargo
- autoclean
- remove older/younger than
- git gc
- regex query
- top cache items
- clean-unref
- sccache stats
- dry run
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what cargo-cache does.
- cargo-sweep A cargo subcommand for cleaning up unused build files generated by Cargo
- Kondo Cleans dependencies and build artifacts from your projects.
- npkill Easily find and remove old and heavy node_modules, artifacts, caches and dev leftovers
- DevCleaner for Xcode If you want to reclaim tens of gigabytes of your storage used for various Xcode caches - this tool is for you!
