# Install bear with Homebrew, apk, apt, dnf, Nix, pacman, MacPorts, winget, zypper

Generate compilation database for clang tooling. Version 4.1.5 via Homebrew; verified 2026-07-03. Also installable with debian: sudo apt install bear.

## Install

```sh
sudo av install brew:bear
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install bear
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install Bear
```

  Evidence: MacPorts ports tree: devel/Bear/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add bear
```

  Evidence: Alpine Linux edge package indexes: bear from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install bear
```

  Evidence: Debian stable package indexes: bear from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install bear
```

  Evidence: Fedora Rawhide package metadata: bear from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#bear
```

  Evidence: nixpkgs package indexes: pkgs/by-name/be/bear/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S bear
```

  Evidence: Arch Linux sync databases: bear from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install Bear
```

  Evidence: openSUSE Tumbleweed package metadata: Bear from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

### Windows

- winget (92%):

```sh
winget install --id the-sz.Bear -e
```

  Evidence: Windows Package Manager source index: the-sz.Bear from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:bear
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/bear>
- **Version:** 4.1.5
- **Source summary:** Generate compilation database for clang tooling
- **Homepage:** <https://github.com/rizsotto/Bear>
- **Repository:** <https://github.com/rizsotto/Bear>
- **Upstream docs:** <https://github.com/rizsotto/Bear#readme>
- **License:** GPL-3.0-or-later
- **Source archive:** <https://github.com/rizsotto/Bear/archive/refs/tags/4.1.5.tar.gz>
- **Last updated:** 2026-07-03T17:56:33Z
- **Generated:** 2026-07-25T07:20:51+00:00

## Executables

- bear (cli)
- bear-driver (cli)
- bear-wrapper (cli)
- bear (alias)
- bear-driver (alias)
- bear-wrapper (alias)

## Build dependencies

- pkgconf
- rust

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-25
- Package-manager version: 4.1.5
- Package-manager updated: 2026-07-03
- Local data: ok
- Upstream repository: https://github.com/rizsotto/Bear
- Upstream latest detected: 4.1.5 (current)
## Project history and usage

Bear generates compile_commands.json compilation databases for Clang tooling by capturing compiler invocations during a build.

### Project history

The official repository describes Bear as a tool for producing the JSON compilation database used by Clang-based tools to understand compiler flags, include paths, and other translation-unit settings.

Bear exists for build systems that cannot emit a compilation database directly. Its README now advises users to prefer native compilation-database export from CMake, Meson, or Bazel when available, and to use Bear as the compatibility bridge for other builds.

The install documentation notes that Bear has been around for a while, is packaged by many distributions, and is now implemented in Rust, with a preload library still involved in compiler-call interception.

### Adoption history

Bear's adoption followed the spread of clang tooling, clangd, clang-tidy, and editor integrations that expect compile_commands.json. The supplied package metadata shows broad packaging across Homebrew, Debian, Ubuntu, Fedora, Alpine, Arch, MacPorts, Nix, Winget, and openSUSE.

The README warns that some package managers still ship the 2.4.x command-line behavior, which is a useful package-history detail: Bear is widely packaged, but users can encounter different major-version interfaces depending on distribution lag.

### How it is used

Modern Bear usage is `bear -- <build-command>`. It writes compile_commands.json to the current working directory after observing the build.

The README calls out platform-specific limitations around interception, including macOS System Integrity Protection and sandboxed builds such as Nix and Flatpak; users are directed to the wiki for workarounds.

### Why package nerds care

Bear is important because compile_commands.json became the lingua franca for C and C++ tooling. Installing Bear can make old Makefile or custom builds visible to clangd and static-analysis tools without rewriting the build system.

For package nerds it is also a reminder that developer tools can be infrastructure glue: a small CLI whose whole job is to translate messy local build behavior into a stable JSON artifact other tools understand.

### Timeline

- 2012: The official GitHub repository for Bear was created.
- 2022-2025: The GitHub releases show the 3.x series progressing through multiple distribution-era releases.
- 2026: The GitHub releases show the 4.x series, while the install docs describe the current Rust implementation.

### Related projects

- Clang's JSON Compilation Database is the direct data format Bear produces.
- CMake, Meson, and Bazel are related because Bear's README names them as build systems whose native compilation-database export should usually be preferred.

### Sources

- <https://clang.llvm.org/docs/JSONCompilationDatabase.html>
- <https://github.com/rizsotto/Bear#readme>
- <https://github.com/rizsotto/Bear/blob/master/INSTALL.md>
- <https://github.com/rizsotto/Bear/releases>
- input.json source_facts.package-manager


## Security Notes

broad file, network, media, or database tool signal.

- **Geiger risk:** blue / medium
- broad file, network, media, or database tool signal

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** bear
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - bear - 3.1.6-1: normalized package name match | Debian stable package indexes: bear from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | generate compilation database for Clang tooling | https://github.com/rizsotto/Bear
- Debian apt - libear - 3.1.6-1: normalized package name match | Debian stable package indexes: libear from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | generate compilation database for Clang tooling (wrapper library) | https://github.com/rizsotto/Bear
- Nix - bear: normalized package name match | nixpkgs package indexes: pkgs/by-name/be/bear/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - bear - 3.1.3-1build4: normalized package name match | Ubuntu 24.04 LTS package indexes: bear from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | generate compilation database for Clang tooling | https://github.com/rizsotto/Bear
- Ubuntu apt - libear - 3.1.3-1build4: normalized package name match | Ubuntu 24.04 LTS package indexes: libear from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | generate compilation database for Clang tooling (wrapper library) | https://github.com/rizsotto/Bear
- apk - bear - 4.1.4-r0: normalized package name match | Alpine Linux edge package indexes: bear from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Tool that generates a compilation database for clang tooling | https://github.com/rizsotto/Bear
- apk - bear-doc - 4.1.4-r0: normalized package name match | Alpine Linux edge package indexes: bear-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Tool that generates a compilation database for clang tooling (documentation) | https://github.com/rizsotto/Bear
- dnf - bear - 4.1.4-1.fc45: normalized package name match | Fedora Rawhide package metadata: bear from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Tool that generates a compilation database for clang tooling | https://github.com/rizsotto/bear
- pacman - bear - 4.1.4-1: normalized package name match | Arch Linux sync databases: bear from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A tool to generate compilation database for clang tooling | https://github.com/rizsotto/Bear
- zypper - Bear - 3.1.6-1.20: normalized package name match | openSUSE Tumbleweed package metadata: Bear from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Tool to generate compilation database for clang tooling | https://github.com/rizsotto/Bear
- MacPorts - Bear: normalized package name match | MacPorts ports tree: devel/Bear/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- winget - the-sz.Bear: normalized package name match | Windows Package Manager source index: the-sz.Bear from https://cdn.winget.microsoft.com/cache/source.msix


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://www.automicvault.com/pkg/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [pkgconf](https://www.automicvault.com/pkg/brew/pkgconf/) - Build dependency declared by Homebrew.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [compiledb](https://www.automicvault.com/pkg/brew/compiledb/) - Shares av.db curated category or tags: build-tools, clang, cli, compilation-database, developer-tools.
- [ant](https://www.automicvault.com/pkg/brew/ant/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [bazel](https://www.automicvault.com/pkg/brew/bazel/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [bazel-diff](https://www.automicvault.com/pkg/brew/bazel-diff/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [boot-clj](https://www.automicvault.com/pkg/brew/boot-clj/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [ccache](https://www.automicvault.com/pkg/brew/ccache/) - Shares av.db curated category or tags: build-tools, clang, cli, developer-tools.
- [dub](https://www.automicvault.com/pkg/brew/dub/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [leiningen](https://www.automicvault.com/pkg/brew/leiningen/) - Shares av.db curated category or tags: build-tool, build-tools, cli, developer-tools.
- [maturin](https://www.automicvault.com/pkg/brew/maturin/) - Local metadata places this package in an adjacent workflow. Shared terms: build, build-tool, build-tools, cli, developer.

## Combined YAML source

View the package source record on GitHub. [combined/bear.yml](https://github.com/automic-vault/db/blob/main/combined/bear.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
