# 使用 Homebrew, chocolatey, MacPorts, Nix, pacman, scoop, winget, zypper 安装 bazel

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

## 安装

```sh
sudo av install brew:bazel
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install bazel
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install bazel
```

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

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#bazel
```

  证据: nixpkgs package indexes: bazel from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- pacman (92%):

```sh
sudo pacman -S bazel
```

  证据: Arch Linux sync databases: bazel from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install bazel8
```

  证据: openSUSE Tumbleweed package metadata: bazel8 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install bazel
```

  证据: Chocolatey community package catalog: bazel from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','azurestorageemulator'

- Scoop (92%):

```sh
scoop install main/bazel
```

  证据: Scoop official bucket manifest trees: bucket/bazel.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id Bazel.Bazel -e
```

  证据: Windows Package Manager source index: Bazel.Bazel from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:bazel
- **软件包管理器:** Homebrew
- **版本:** 9.2.0
- **来源摘要:** Google's own build tool
- **主页:** <https://bazel.build/>
- **仓库:** <https://github.com/bazelbuild/bazel>
- **最后更新:** 2026-07-29T08:54:40+01:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- bazel-9.2.0 (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 9.2.0
## 项目历史与用法

Bazel is Google's open-source build and test system for large, multi-language codebases, famous in package-manager culture for bringing Google's Blaze-style hermetic, cached, queryable build graph to public monorepos.

### 项目历史

The public bazelbuild/bazel repository dates to February 2015 and the project reached Bazel 1.0 on October 10, 2019. The 1.0 announcement marked the start of semantic versioning and stability windows for backward-incompatible releases.

Bazel's official introduction emphasizes a high-level build language, Starlark rules, incremental rebuilds based on file content and commands, local and distributed caching, parallel execution, hermeticity, and scale to 100k+ source files and tens of thousands of users.

The modern Bazel line is shaped by dependency-management and rule-modularization migrations. Bazel 7 turned Bzlmod on by default; Bazel 8 turned the old WORKSPACE mechanism off by default; Bazel 9 is planned to remove WORKSPACE functionality.

### 采用历史

Bazel's adoption grew from Google's internal build culture into a public ecosystem of language rules, remote-cache servers, registries, CI tooling, and version managers. The official users page lists companies including Adobe, Asana, Canva, Databricks, Dropbox, Google, LinkedIn, Lyft, Nvidia, Pinterest, Snap, Stripe, Tinder, and Twitter.

Package-manager adoption reflects that cross-platform reach: the input records Bazel packages across Homebrew, Chocolatey, MacPorts, Nix, Arch, Scoop, winget, and zypper.

### 使用方式

A Bazel workspace defines BUILD files and targets, then users run bazel build, test, run, query, or cquery from the command line. Bazel analyzes dependencies into an action graph and executes only the actions needed for requested outputs.

For repeatable package-manager workflows, .bazelrc files matter: official docs document system, workspace, and user rc files, while Bazelisk and .bazelversion are often used to pin the Bazel version per repository.

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

Bazel is a package-nerd landmark because it made build tools behave more like content-addressed package systems: actions are keyed, cached, queried, remotely shared, and constrained toward hermetic reproducibility.

Its formula history is also interesting because current Homebrew carries both the moving bazel formula and versioned bazel@7 and bazel@8 formulas, acknowledging that Bazel upgrades can be migration events rather than ordinary patch bumps.

### 时间线

- 2015-02: Public bazelbuild/bazel git history begins.
- 2019-10-10: Bazel 1.0 is released and the project starts semantic-versioned release stability windows.
- 2023-12-11: Bazel 7.0 LTS is released with Bzlmod, Build without the Bytes, and Skymeld enabled by default.
- 2024-12-09: Bazel 8.0 LTS is released with Bzlmod as the default dependency-management system and WORKSPACE disabled by default.
- 2026: The input's Homebrew formula metadata shows the unversioned bazel formula tracking the Bazel 9 line.

### Related projects

- Bazelisk is the companion launcher/version manager that selects and downloads the right Bazel binary for a workspace.
- bazel-remote provides a standalone remote cache for Bazel and other REAPI clients.
- bazel-diff computes impacted Bazel targets between Git revisions for CI test selection.
- Bazel Central Registry and Bzlmod form Bazel's modern module distribution layer.

### 来源

- <https://bazel.build/about/intro documents Bazel's build/test model, scale, caching, supported platforms, and command-line use.>
- <https://bazel.build/community/users documents public adopters.>
- <https://blog.bazel.build/2019/10/10/bazel-1.0.html documents the 1.0 release and semantic-versioning policy.>
- <https://blog.bazel.build/2023/12/11/bazel-7-release.html documents Bazel 7 defaults including Bzlmod.>
- <https://blog.bazel.build/2024/12/09/bazel-8-release.html documents Bazel 8, Bzlmod default dependency management, and WORKSPACE being off by default.>
- source_facts.package-manager records package-manager availability across ecosystems.


## 安全说明

generalized runtime or code generation signal.

- **Geiger 风险:** yellow / 中
- generalized runtime or code generation signal


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: /etc/bazel.bazelrc, .bazelrc in the workspace directory, ~/.bazelrc
- Windows: %ProgramData%\bazel.bazelrc, %USERPROFILE%\.bazelrc, %HOME%/.bazelrc
## 其他软件包管理器记录

- Nix - bazel: normalized package name match | nixpkgs package indexes: bazel from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- pacman - bazel - 9.2.0-2: normalized package name match | Arch Linux sync databases: bazel from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Correct, reproducible, and fast builds for everyone | https://bazel.build/
- pacman - bazelisk - 1.29.0-1: normalized package name match | Arch Linux sync databases: bazelisk from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A user-friendly launcher for Bazel. | https://github.com/bazelbuild/bazelisk
- zypper - bazel8 - 8.4.1-1.5: normalized package name match | openSUSE Tumbleweed package metadata: bazel8 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Tool for the automation of building and testing of software | https://bazel.build/
- MacPorts - bazel: normalized package name match | MacPorts ports tree: devel/bazel/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - bazel: normalized package name match | Chocolatey community package catalog: bazel from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','azurestorageemulator'
- Scoop - main/bazel: normalized package name match | Scoop official bucket manifest trees: bucket/bazel.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - Bazel.Bazel: normalized package name match | Windows Package Manager source index: Bazel.Bazel from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

View the package source record on GitHub. [combined/bazel.yml](https://github.com/mxcl/pkgdb/blob/main/combined/bazel.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
