Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. Bear

Bear

GPL-3.0Rust4.2.2

A tool that generates a JSON compilation database for Clang-based tools by intercepting compiler calls during a build.

GitHubGitHub
6.5k stars369 forks0 contributors

What is Bear?

Bear is a command-line tool that generates a JSON compilation database for Clang-based tooling. It solves the problem of obtaining a compilation database from build systems that do not natively support exporting one, by intercepting compiler invocations during the build process.

Target Audience

C/C++ developers and teams using Clang-based tools (like clang-tidy, clangd, or ccls) for static analysis, refactoring, or IDE integration, especially those with non-CMake/Meson/Bazel build systems.

Value Proposition

Developers choose Bear because it provides a simple, cross-platform way to generate compilation databases without modifying build scripts, enabling advanced Clang tooling support in environments where native database generation is unavailable.

Overview

Generate compile_commands.json for any C or C++ build

Use Cases

Best For

  • Generating compilation databases for Makefile-based projects
  • Enabling Clang tooling in legacy or custom build systems
  • Integrating clangd or clang-tidy into IDEs for C/C++ projects
  • Running static analysis on projects with unsupported build systems
  • Setting up code navigation and refactoring tools in non-CMake environments
  • Capturing compiler flags for cross-platform C/C++ development

Not Ideal For

  • Projects using CMake, Meson, or Bazel with native compilation database support
  • Sandboxed build environments like Nix or Flatpak without additional configuration
  • Highly parallel or distributed builds where compiler interception may miss invocations
  • Real-time development workflows requiring zero-overhead build monitoring

Pros & Cons

Pros

Cross-Platform Support

Works on Linux, macOS, multiple BSD variants, and Windows, as explicitly listed in the README, ensuring broad compatibility.

Simple Command-Line Usage

Just prefix your build command with 'bear --', making it easy to integrate without modifying build scripts, as highlighted in the usage section.

Pragmatic Fallback Solution

Provides a reliable alternative for build systems lacking native JSON compilation database export, focusing on simplicity as per the philosophy.

Automatic Compiler Capture

Intercepts compiler invocations during builds to generate the database automatically, enabling Clang tooling support for unsupported systems.

Cons

Environment-Specific Hurdles

Requires extra configuration for macOS System Integrity Protection or sandboxed builds like Nix, as noted in the limitations section of the README.

Interception Reliability Issues

May miss compiler calls in complex build setups, such as those using wrapper scripts or indirect invocations, leading to incomplete databases.

Performance Overhead

Build interception adds overhead, making it slower and less efficient compared to native compilation database generation in tools like CMake.

Frequently Asked Questions

Quick Stats

Stars6,471
Forks369
Contributors0
Open Issues0
Last commit3 days ago
CreatedSince 2012

Tags

#clang#developer-tools#build-tools#c-plus-plus#build-system#build-systems#cross-platform#compilation-database#code-analysis#static-analysis#build-tool

Included in

C/C++70.6k
Auto-fetched 9 hours ago

Related Projects

VcpkgVcpkg

C++ Library Manager for Windows, Linux, and MacOS

Stars27,451
Forks7,710
Last commit4 days ago
BuckBuck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

Stars8,541
Forks1,130
Last commit2 years ago
SccacheSccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.

Stars7,661
Forks739
Last commit5 days ago
awesome-cmakeawesome-cmake

A curated list of awesome CMake resources, scripts, modules and examples.

Stars5,416
Forks490
Last commit26 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub