Homebrew is an extremely useful tool until it isn’t. Sometimes, it can hinder you.
For example, I was trying to install Bazel, which is required to run an image-captioning inference engine I was trying to run. Brew had some issues I needed to work through. Here is the story:
Bazel, as of right now, no longer supports Java 7 and below. It only supports Java 8. Great, that’s fine, I’ll just use
brew cask install java like it told me to.
Let’s verify that we have the right versions of Java:
Then, I updated my
~/.zshrc to have this line:
Then, I ran
source ~/.zshrc to ensure this change gets picked up and
$JAVA_HOME gets set to my Java 9 installation.
Great! I just installed Java 9. Bazel should be happy now. Let’s try again:
Perfect! Now, let me try to use Bazel:
It looks like Bazel only supports Java 8. How unfortunate. Looks like we’ll have to use Homebrew to install Java 8.
This led me down a rabbithole of trying to install older versions of Java using Homebrew. Eventually, I found the right Caskroom command I needed to run:
Let’s verify again:
Once again, I needed to update my
~/.zshrc to ensure
$JAVA_HOME is correct:
Then, of course, I had to run
source ~/.zshrc again.
Finally, after all this time spent trying to get my toolchain working, I was able to run the
bazel command I needed:
I hope this helps someone else out there!