LinuxmacOSWindows

Where Does ccache Store Its Cache and Config?

ccache keeps compiled object cache plus a small config file in standard per-OS cache locations. Exact folders and overrides inside.

Last updated

ccache stores two things: a cache directory full of hashed compilation results, and a tiny config file with size limits and behavior flags. Defaults follow each OS cache convention, with CCACHE_DIR overriding the location.

Config lives apart from cache on purpose. Copy the config when standardizing build machines, but let each machine grow its own cache. Sharing one cache folder between concurrent builds invites corruption.

Where ccache stores this, by platform

Linux
~/.cache/ccache

Default cache root; override with CCACHE_DIR. Config at ~/.config/ccache/ccache.conf. Check hit rates with ccache -s before resizing the limit.

macOS
~/.cache/ccache

Same XDG-style layout as Linux. Homebrew and manual installs share these paths, so switching install method keeps cache and config.

Windows
%LOCALAPPDATA%\ccache

Follows Local AppData convention. Set CCACHE_DIR to relocate, e.g. onto a faster drive, before running builds.

Frequently asked questions

How do I clear the ccache cache?

Delete the cache directory for your OS while no builds run. The next build repopulates it from scratch, slower once, then fast again.

How do I move the ccache directory?

Set CCACHE_DIR to the new path before building. Move the old directory contents there first to keep existing hits instead of starting cold.

Notice an outdated path? Let us know.