Understanding Bazel Output Directories
bazel-<workspace-name>
, bazel-out
, bazel-bin
, bazel-testlogs
, ~/.cache/bazel
et al.July 23, 2025
When a Bazel build is initiated, Bazel generates a sophisticated hierarchy of
out-of-source directories and artifacts (often under
~/.cache/bazel
on Linux)
and then symlinks to them from the project’s source tree via
bazel-<workspace-name>
, bazel-out
, bazel-bin
and bazel-testlogs
. These
aren’t just clutter—they’re integral to Bazel’s architectural design and
execution model. Understanding each directory’s role in a conventional Bazel
build is crucial to using Bazel effectively.