10

I tried to install an older version of Bazel using homebrew by specifying the commit I need (https://raw.githubusercontent.com/bazelbuild/homebrew-tap/c8a0ccc2a8b442d9887d88c6380f835f533ffd47/Formula/bazel.rb).

I used the command brew install https://raw.githubusercontent.com/bazelbuild/homebrew-tap/c8a0ccc2a8b442d9887d88c6380f835f533ffd47/Formula/bazel.rb. However, it points to the Homebrew core instead of the Bazel tap.

Has anyone used brew to manage Bazel version? Any suggestions are highly appreciated.

Malith
  • 685
  • 1
  • 8
  • 14
  • What do you mean by "it points to the Homebrew core instead of the Bazel tap"? This command works for me; it does use the formula in the URL and not the core one. – bfontaine Sep 03 '19 at 12:51
  • Not a Mac person, so this is somewhat tangential, but perhaps still helpful: If depending on specific version(s) of bazel, you may want to consider [`bazelisk`](https://github.com/bazelbuild/bazelisk) to handle your requirements independent of host setup. – Ondrej K. Sep 05 '19 at 07:42
  • Same here. I am stuck at this point. HomeBrew's lates (Bazel 1.2.0) cannot build TensorFlow for me, rather I am being told to downgrade to 1.1.0. The suggested downgrade method which the OP has stated does not work – Kermit_ice_tea Nov 25 '19 at 21:23

3 Answers3

26
brew tap bazelbuild/tap
brew extract bazel bazelbuild/tap --version 3.1.0
brew install bazel@3.1.0

That should do.

Dmitry Grebenyuk
  • 471
  • 1
  • 5
  • 7
  • If you get build errors on last step, it's likely because you need to accept xcode license agreement `sudo xcodebuild -license` – Zain Qasmi Feb 15 '23 at 22:16
  • No build errors on the last step, but after it finishes, the bazel@3.1.0 folder created in my Cellar folder disappears and the package does not appear anywhere in my homebrew packages – George Kamar Apr 04 '23 at 18:16
  • Also, supposing it had worked, how could I call this version from the command line with the new naming scheme ? Is there a way for me to just call bazel instead of having to call bazel@3.1.0 from the command line ? (specify a default version that isnt the latest one ) – George Kamar Apr 04 '23 at 18:18
1

For ex: to install bazel 1.1.0

$ wget https://github.com/bazelbuild/bazel/releases/download/1.1.0/bazel-1.1.0-installer-darwin-x86_64.sh
$ chmod +x bazel-1.1.0-installer-darwin-x86_64.sh
$ ./bazel-1.1.0-installer-darwin-x86_64.sh --user
Thien Pham
  • 29
  • 1
  • 4
0

We can try this command to install bazel 3.7.2:

cd "/usr/local/lib/bazel/bin" && curl -fLO https://releases.bazel.build/3.7.2/release/bazel-3.7.2-darwin-x86_64 && chmod +x bazel-3.7.2-darwin-x86_64
Thien Pham
  • 29
  • 1
  • 4