Install Bazel on macOS using one of the following methods:
Bazel comes with two completion scripts. After installing Bazel, you can:
- Access the bash completion script
- Install the zsh completion script
Installing using the binary installer
The binary installers are on Bazel’sGitHub releases page.
Alternatives to Homebrew for Linux, Windows, Mac, Web, BSD and more. Filter by license to discover only free or Open Source alternatives. This list contains a total of 25+ apps similar to Homebrew. List updated: 5/19/2020 5:28:00 PM. If you’re looking for some noteworthy packages, check out this list of some of the best Homebrew packages available for Mac users. If you’re a developer you might also be interested in getting node.js and nom along with installing the updated Python 3 package on a Mac.
The installer contains the Bazel binary.1 Some additional librariesmust also be installed for Bazel to work.
Step 1: Install Xcode command line tools
If you don’t intend to use ios_*
rules, it is sufficient to install the Xcodecommand line tools package by using xcode-select
:
Otherwise, for ios_*
rule support, you must have Xcode 6.1 or later with iOSSDK 8.1 installed on your system.
Download Xcode from theApp Store or theApple Developer site.
Once Xcode is installed, accept the license agreement for all users with thefollowing command:
Step 2: Download the Bazel installer
Next, download the Bazel binary installer namedbazel-<version>-installer-darwin-x86_64.sh
from theBazel releases page on GitHub.
Note: on macOS Catalina, due to Apple’s new app notarization requirements,you will need to download the installer from the terminal using curl
:
This is a temporary workaround until we fix notarization in our macOS releaseworkflow (#9304).
Step 3: Run the installer
Run the Bazel installer as follows:
Best Homebrew Apps Mac
The --user
flag installs Bazel to the $HOME/bin
directory on your system andsets the .bazelrc
path to $HOME/.bazelrc
. Use the --help
command to seeadditional installation options.
If you are on macOS Catalina and get an error that “bazel-real” cannot beopened because the developer cannot be verified, you will need to re-downloadthe installer from the terminal using curl
as a workaround; see Step 2 above.
Step 4: Set up your environment
If you ran the Bazel installer with the --user
flag as above, the Bazelexecutable is installed in your $HOME/bin
directory. It’s a good idea to addthis directory to your default paths, as follows:
You can also add this command to your ~/.bashrc
, ~/.zshrc
, or ~/.profile
file.
All set! You can confirm Bazel is installed successfully by running thefollowing command:
Mac Homebrew Tutorial
To update to a newer release of Bazel, download and install the desired version.
Installing using Homebrew
Step 1: Install Homebrew on macOS
Install Homebrew (a one-time step):
Step 2: Install Bazel via Homebrew
Install the Bazel package via Homebrew as follows:
All set! You can confirm Bazel is installed successfully by running thefollowing command:
Once installed, you can upgrade to a newer version of Bazel using thefollowing command: