bazel-compile-commands

May 2, 2026 ยท View on GitHub

A tool that generates a compile_commands.json file from Bazel build configurations, enabling IDE support for C/C++ projects built with Bazel.

Installation

pipx install git+https://github.com/robinlinden/bazel-compile-commands.git@master

Usage

Navigate to your Bazel workspace root and run:

bccommand

The script will:

  1. Query your Bazel workspace for C/C++ compilation actions.
  2. Extract and normalize compilation commands.
  3. Generate a compile_commands.json file in your workspace root.

Custom Arguments

You can pass additional arguments to bazel aquery, such as configuration options:

bccommand --config=myconfig