HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
rizsotto
Bear
Rust2016–2026
rizsotto / Bear

Bear

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

14Distinct people
15Mentions
0Explicit recommenders
6.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

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

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year15 dated mentions

Observed mentions: 2016-05-27 04:50:05 UTC to 2026-05-18 17:42:04 UTC.

012342016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC202
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC110
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC211
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC110

What Hacker News says

15 sources
Almost the same emoticon logo too. ʕ•ᴥ•ʔ Bear vs. ʕ·ᴥ·ʔ Build EAR The compilation database tool (https://github.com/rizsotto/Bear), is extremely helpful. It got CCLS/clangd working for me over multiple in-house build systems at a vfx studio. It also is super helpful for debugging. I have used it a lot alongside a script which converts a compile_commands.json to a sequence of commands, so I can edit them individually without fiddling with the build system, and then once fixed (such as adding a flag to one TU) try to find the way to do that in the build system.
In Bear is now source-available
With lsp you don't need tags. You essentially have a lsp server like clangd [0] running in the background for finding references, definitions, code completion etc. With the latest release 29.1, emacs comes with an in-built lsp client - eglot[1]. So you need to (a) Set up clangd or some other lsp server for c++. Make sure it's accessible from emacs (use something like exec-path-from-shell to get your shell paths into emacs) (b) Set up your project for clangd - this involves generating a compile_commands.json which basically lists the full compilation invocation of each and every file in your project. CMake has options to do that and likely many other build tools or maybe use something like bear[2]. (c) Enable eglot (install the package if needed on older versions of emacs) and configure appropriately. I also use projectile for project mgm
Read the rest
t though emacs now has something in built for that too. I can post my configs if that helps. [0] https://clangd.llvm.org/ [1] https://github.com/joaotavora/eglot [2] https://github.com/rizsotto/Bear
In How to Learn Emacs (2012)
> Ultimately things like C++ code completion and intellisense require a lot of work and code to get right, and NeoVim/Vim attempts are not there yet, for example I had to give up when the only way to figure out what compilation flags a project uses meant configuring it manually. Not sure if I understand this right, but have you heard of https://github.com/rizsotto/Bear? It intercepts compilation calls to generate a clang compilation database used by C and C++ LSP implementations. This way you just have to compile the project the normal way, only wrapping the initial call (for example, to `make`) with bear: `bear make`. Once you have the database, a LSP server like ccls should work out of the box with the project.
In NvChad: An attempt to make Neovim TUI as functional as an IDE
You make your build system emit a compile-definitions.json file that has all the compiler flags for every file you compile and feed it to a language server (rtags or clangd usually, either standalone or part of another plugin like YouCompleteMe). CMake has a flag to do that as part of its configuration step (and remembers it), for other build systems you can use something like bear: https://github.com/rizsotto/Bear .
In Neovim 0.5 is overpowering
When writing Ruby C extensions, you almost inevitably need to learn to read the Ruby codebase (written in C). It helps if you can get your preferred IDE to build and understand the codebase. For people who want to use LSP + clangd to explore the Ruby codebase, I wrote up some instructions here: https://blog.jez.io/clangd-ruby/ tl;dr: Bear[1] is a tool that hijacks a process tree, looks for calls to clang, records the args it was given, and serializes those out into a compile_commands.json file that can be consumed by various clang tools, including clangd. It's really slick and in my experience Just Works (the highest praise, IMO). You can use more or less the same trick described in that post to get the Ruby C extensions you build working with LSP + clangd (no guide for this, but it should be self-evident from reading the original guide).
Read the rest
In Definitive Guide to Ruby's C API
For C/C++ code, you can already do refactoring using clang-tidy scripts [0], or even can write custom linters using libtooling [1] and leverage the AST Matchers [2] which work at the AST level. All that's needed is a compile_commands.json file which can be easily generated via most build systems, or you can use Bear [3]/some other tool (or write a script that logs all syscalls and generate it yourself). [0] https://releases.llvm.org/12.0.0/tools/clang/tools/extra/doc... [1] https://releases.llvm.org/12.0.0/tools/clang/docs/LibTooling... [2] https://releases.llvm.org/12.0.0/tools/clang/docs/LibASTMatc... [3] https://github.com/rizsotto/Bear
In Semgrep: Semantic grep for code

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.