Skip to content

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

  1. brew search java to find all available Java-related formulas
  2. brew info to show the formula details.
  3. brew install java to install the latest JDK.
  4. 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"