Installing Bazel on macOS

Install Bazel on macOS using one of the following methods:


Installing using binary installer

The binary installers are on Bazel’s GitHub releases page.


Step 1: Install Xcode command line tools




sudo xcodebuild -license accept

Step 2: Download the Bazel installer


Note: on MacOS Catalina, due to Apple’s new app notarization requirements, you will need to download the installer from the terminal using curl:

# Replace <version> as appropriate.
curl -LO<version>/bazel-<version>

This is a temporary workaround until we fix notarization in our MacOS release workflow (#9304).

Step 3: Run the installer

Run the Bazel installer as follows:

chmod +x bazel-<version>
./bazel-<version> --user


If you are on MacOS Catalina and get an error that “bazel-real” cannot be opened because the developer cannot be verified, you will need to re-download the installer from the terminal using curl as a workaround; see Step 2 above.

Step 4: Set up your environment


export PATH="$PATH:$HOME/bin"



bazel --version


Installing using Homebrew

Step 1: Install Homebrew on macOS

Install Homebrew (a one-time step):


Step 2: Install the Bazel Homebrew package


Install the Bazel package via Homebrew as follows:

brew tap bazelbuild/tap
brew install bazelbuild/tap/bazel


bazel --version


brew upgrade bazelbuild/tap/bazel