# 使用 Homebrew, apk, apt, dnf, Nix, pacman, MacPorts, winget, zypper 安装 bear

查看 bear 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

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

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install bear
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install Bear
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

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

## 软件包事实

- **软件包键:** brew:bear
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/bear>
- **版本:** 4.1.5
- **来源摘要:** Generate compilation database for clang tooling
- **主页:** <https://github.com/rizsotto/Bear>
- **仓库:** <https://github.com/rizsotto/Bear>
- **上游文档:** <https://github.com/rizsotto/Bear#readme>
- **许可证:** GPL-3.0-or-later
- **源码归档:** <https://github.com/rizsotto/Bear/archive/refs/tags/4.1.5.tar.gz>
- **最后更新:** 2026-07-03T17:56:33Z
- **已生成:** 2026-07-25T07:20:51+00:00

## 可执行文件

- bear (cli)
- bear-driver (cli)
- bear-wrapper (cli)
- bear (别名)
- bear-driver (别名)
- bear-wrapper (别名)

## 构建依赖

- pkgconf
- rust

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-07-25
- 管理器版本: 4.1.5
- 管理器更新时间: 2026-07-03
- 本地数据: OK
- 上游仓库: https://github.com/rizsotto/Bear
- 检测到的最新版本: 4.1.5 (当前)
## 项目历史与用法

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

### 项目历史

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.

### 采用历史

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.

### 使用方式

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.

### 为什么软件包爱好者会关心

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.

### 时间线

- 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.

### 来源

- <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


## 安全说明

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

- **Geiger 风险:** blue / 中
- broad file, network, media, or database tool signal

## 源数据库详情

- **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

## 其他软件包管理器记录

- 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


## 相关链接

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


## 来源

- 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
