Using HomeBrew to Install Java JDK11 on MacOS (2021)

Erick Gustavo López Siordia
1 min readAug 5, 2021

--

I know there is a post with the exact same title but since it’s a little bit outdated I’d like to post a slightly adjusted version for the people who is googling a updated solution.

Step 1: Install Homebrew (if you haven’t done it already)

$ /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

Step 2: Update it (if you haven’t done it already)

$ brew update

Step 3: Install Java11

$ brew install java11

Step 4: Symlink it

If you skip this step the system won’t be able to find a java runtime for you to use.

sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

Step 5: Test

If you see something similar after typing the command with the version flag you’re good to go! 🙂

$ java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9)
OpenJDK 64-Bit Server VM (build 11.0.10+9, mixed mode)

Please let me know if you got issues so I can update this guide. Have a nice day!

--

--

Erick Gustavo López Siordia

(He/Him) 🏳️‍🌈 INTJ-A, Asker, Aphant, ADHD. I’m an avid software engineer, proud nerd and casual gamer. I got experience in Go, Python and Java.