Homebrew
Setup
Run these two commands in your terminal to add Homebrew to your PATH:
Bash
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/jun/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Install Softwares
Homebrew install latest Java on macOS
brew search java
to find all available Java-related formulasbrew info
to show the formula details.
brew install java
to install the latest JDK.
- Add OpenJDK into the PATH Bash
# For the system Java wrappers to find this JDK, symlink it with sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk # If you need to have openjdk first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc # For compilers to find openjdk you may need to set: export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"