Install Bazel#

This page provides recommendations on how to install Bazel for Bazel-based Pigweed projects.

CLI commands: bazelisk versus bazel#

Pigweed recommends always running bazelisk rather than bazel because bazelisk ensures that you always run the correct Bazel version defined in your project’s .bazelversion file.

Alternative setups#


Most Linux distributions don’t have a recent version of Bazelisk in their software repositories, or they don’t have it at all.

Install from a binary release:

  1. Get the latest Bazelisk release.

  2. Add the binary to your PATH.

Install from source:

  1. Install Go.

  2. Clone the source:

    go install
  3. Add the Go binaries to your PATH:

    export PATH=$PATH:$(go env GOPATH)/bin

(Recommended) Homebrew:

brew install bazelisk


sudo port install bazelisk

(Recommended) winget:

winget install --id=Bazel.Bazelisk  -e


choco install bazelisk