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.
Recommended setup#
If you use Visual Studio (VS) Code, Pigweed’s VS Code extension can manage Bazel for you:
Get VS Code.
Install the Pigweed extension for VS Code.
Alternative setups#
Caution
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:
Get the latest Bazelisk release.
Add the binary to your
PATH
.
Install from source:
Install Go.
Clone the source:
go install github.com/bazelbuild/bazelisk@latest
Add the Go binaries to your
PATH
:export PATH=$PATH:$(go env GOPATH)/bin