Where apps hide your files
Rust spreads over three kinds of place: toolchains in ~/.rustup, tools and downloaded crates in ~/.cargo, and a target folder in every project. The last one is usually where the gigabytes are.
~/.rustup (toolchains, managed by rustup)
~/.cargo (Cargo home: installed tools, downloaded crates)
<project>/target (build output, one per project)
Both dot-folders are the defaults for a rustup install; the Cargo book says Cargo home is $HOME/.cargo, and rustup show home prints the rustup folder (on the Mac used for this guide, ~/.rustup). They are hidden in Finder. Choose Go > Go to Folder (⇧⌘G), paste the path, and press Return, or in Terminal:
open ~/.cargo
open ~/.rustup
| Path | What it holds |
|---|---|
toolchains/<name>/ | One folder per installed toolchain, such as stable-aarch64-apple-darwin. It holds bin, etc, lib, libexec and share. |
settings.toml | rustup's own settings: default toolchain, profile, and any per-directory overrides. |
downloads/, tmp/ | Working folders for installs, empty when nothing is being installed. |
update-hashes/ | Records rustup uses to skip updates it does not need. |
On the Mac used for this guide, ~/.rustup was about 1.4 GB, nearly all of it one toolchain, with lib accounting for around 580 MB. The folder name tells you the architecture: aarch64-apple-darwin is native Apple silicon, x86_64-apple-darwin is Intel (or a Rosetta shell, so check this if builds feel slow).
List and remove toolchains with rustup rather than Finder:
rustup toolchain list
rustup toolchain uninstall <name>
Both are standard rustup commands; the first only reads.
| Path | What it holds |
|---|---|
bin/ | The cargo, rustc and rustup commands (these are small proxies into the toolchain) plus anything installed with cargo install. |
registry/ | Crates downloaded from crates.io: an index/, cache/ of .crate archives and src/ of unpacked sources. |
git/ | Git dependencies: db/ bare clones and checkouts/. |
config.toml | Your global Cargo configuration, if you made one. |
credentials.toml | The token saved by cargo login. Never share or paste it. |
.crates.toml, .crates2.json | Records of what cargo install put in bin. Do not edit by hand. |
env | A small shell script that adds ~/.cargo/bin to your PATH. |
The Cargo book documents all of these, and warns the internal structure is not stable. On the Mac used for this guide, ~/.cargo was about 42 MB, mostly bin, and registry and git did not exist because no crates had been fetched into that Cargo home. They appear on the first cargo build of a project with dependencies. The installer also adds a line sourcing ~/.cargo/env to your shell startup files, which is how cargo ends up on your PATH.
Every Cargo project builds into its own target folder next to Cargo.toml, with debug and release inside. These regularly reach several gigabytes for a single project, and each project you ever built keeps its own. To see them:
du -sh target
find ~/Documents ~/Developer -maxdepth 4 -name target -type d 2>/dev/null
The second command lists folders named target and does not open them. Not every target folder is Rust (Maven and others use that name too), so look for a Cargo.toml beside it.
To clear one project, run this inside it:
cargo clean
It removes that project's target folder; cargo clean --dry-run shows what would be deleted first, and -p <package> limits it. The next build recompiles everything, which is slow for large projects but loses nothing.
The Cargo book says any part of the cache can be deleted, and Cargo restores what it needs by re-extracting an archive, checking out a repo or re-downloading. So with no build running, you can move ~/.cargo/registry or ~/.cargo/git to the Trash. Since Rust 1.88 Cargo also trims this cache itself: it deletes downloaded files it has not used for 3 months and files it can recreate offline after 1 month, checking at most once a day by default (the cache.auto-clean-frequency setting). Do not delete bin, config.toml, or credentials.toml as part of a cleanup: they are tools and settings, not cache.
Two environment variables control the roots: CARGO_HOME for the Cargo folder and RUSTUP_HOME for the toolchains. Set them before installing, or move the folder contents and then set them. To redirect only build output, Cargo's CARGO_TARGET_DIR variable or the build.target-dir setting in config.toml puts every project's output in one shared folder instead of a target folder in each workspace; --target-dir does the same for one command.
Back up your projects and their Cargo.lock files. Install rustup again on the new Mac, then run cargo install for any tools listed in ~/.cargo/.crates.toml. The toolchains, crates and target folders all come back by themselves.
Spotlight and Finder searches leave out hidden dot-folders like ~/.cargo and ~/.rustup, and the downloaded crates have version-suffixed names that never match what you remember.
Everywhere indexes names in hidden folders, so typing a crate name such as serde-1 finds its .crate archive and unpacked source folder, and typing Cargo.toml lists every Rust project on the Mac, which tells you where the target folders are. Downloaded crates in ~/.cargo/registry/src have their own Cargo.toml too, and projects in Documents or Desktop appear once Everywhere has Full Disk Access. It matches file names only. Press ⌘↵ to reveal one in Finder.
Toolchains go in ~/.rustup and the cargo and rustc commands live in ~/.cargo/bin. Both folders are hidden in Finder.
Into ~/.cargo/registry (index, .crate archives and unpacked source), with git dependencies in ~/.cargo/git.
Yes. cargo clean removes it, and the next build recreates it, just slower. Use cargo clean --dry-run to preview.
Set CARGO_HOME and RUSTUP_HOME before installing, or move the folders and then set them.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised