Skip to content

~/.cache was 3.4 GB, and one abandoned install was 1.9 GB of it

Command-line tools write to ~/.cache, a hidden folder separate from Library/Caches that nothing on macOS clears. Measured at 3.4 GB, what was in it.

4 min read

Mac apps cache into ~/Library/Caches. Command-line tools from the Linux world follow a different convention, the XDG base directory spec, and write to ~/.cache in your home folder instead. It is hidden, it is not in System Settings' storage view, and macOS never tidies it.

FolderSizePut there by
codex-runtimes3.4 GBThe Codex CLI, including a 1.9 GB abandoned install
node/corepack47 MBCorepack's Yarn and pnpm downloads
fontconfig4.6 MBFont lists for command-line tools
gitstatus2.0 MBA shell prompt's git helper
vscode-ripgrep1.4 MBA search binary

One tool was 99 percent of it, which is the usual shape: ~/.cache is a handful of kilobyte-sized entries and one or two very large ones.

Check yours

du -sh ~/.cache/* 2>/dev/null | sort -h | tail

Is it safe to empty?

By the convention, yes. Anything in ~/.cache is meant to be disposable, and a well-behaved tool recreates what it needs. In practice, check the large entries by name, because a few tools keep things there they would rather not re-download:

  • Hugging Face keeps downloaded models in ~/.cache/huggingface. Deleting means downloading gigabytes again. See machine learning caches.
  • pip, uv and pre-commit keep package caches here; clearing them only costs a download. See the uv cache.
  • Install leftovers such as the Codex staging folder are pure waste. See Codex CLI taking up space.

Its macOS counterpart is Library Caches.

Related: pre-commit cache taking up space on Mac.

Related: vcpkg build trees, the wasm-pack cache and Foundry and solc caches.

Common questions

What is the ~/.cache folder on a Mac?

A hidden cache folder used by command-line tools that follow the XDG convention. Mac apps use ~/Library/Caches instead.

Is it safe to delete ~/.cache on a Mac?

Generally yes, as it holds caches. Check large entries first: machine learning models in huggingface are costly to download again.

Does macOS clear ~/.cache automatically?

No. Nothing on macOS manages it, so it grows until you clear it.

How big is ~/.cache usually?

It varies with the tools you use. On the Mac measured it was 3.4 GB, almost all from one tool.

Read next