Linux

Where Does Bazel Store Its Cache?

Bazel output base and repository cache under ~/.cache/bazel on Linux.

Last updated

Bazel writes build outputs, action cache and downloaded repositories under an output base in the user cache tree, keyed by workspace hash. The cache is what makes incremental builds fast and clean builds slow.

Disk usage grows without bound until collected. Point output_base elsewhere for bigger disks and run shutdown plus cache clears when builds act haunted.

Where Bazel stores this, by platform

Linux
~/.cache/bazel

Default output base parent with one hashed directory per workspace plus the repository cache. Override with --output_base for another disk. Inspect the exact base with bazel info output_base. Clear per-workspace with bazel clean, or wipe the tree for a full reset.

Frequently asked questions

Why is Bazel using so much disk?

Every workspace keeps outputs and action cache under the directory above. Run bazel clean --expunge periodically or move output_base to a larger volume.

How do I find my Bazel output base?

Run bazel info output_base inside the workspace. The hashed path it prints is the exact cache root for that repo.

Notice an outdated path? Let us know.