To install OpenJDK on Mac running on Intel or M1/M2 ARM Apple Silicon chip, you can make use of the brew install openjdk command, but if you use it without any version of the lasted Java JDK will get installed which is JDK 18 as of September 2022.
Installing Specific Version of OpenJDK using Brew
Installing Java JDK 8 (ONLY WORKS FOR Intel x86_64)% brew install openjdk@8
Note: OpenJDK 8 is only available for x86_64 architecture,
so you will get an error if you are on ARM M1/M2 Chip.
openjdk@8: The x86_64 architecture is required for this software.
Error: openjdk@8: An unsatisfied requirement failed this build.
You will need to go for other vendors like azul.
brew tap homebrew/cask-versions
brew install --cask zulu8
Installing Java JDK 11
% brew install openjdk@11
Installing Java JDK 17
% brew install openjdk@17

Have Questions? Post them here!
- How to find path of file on Mac Terminal
- How to disable Siri on Mac Monterey
- [fix] macOS Ventura xcrun: error: invalid active developer path missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- Select Line Number TextEdit on Mac
- Go to Specific file path using Mac Finder
- How to find Java HOME in Mac Terminal
- bash: command not found error [macOS Terminal Linux, Unix or Windows]
- Must Know Homebrew Commands for Mac/Linux Users
- How to Insert an Inverted Question Mark on Mac ¿
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- How to make macOS Terminal window Transparent (or Opaque)
- How to check of Updates on Microsoft Edge Browser on Mac (macOS)
- Limit scrollback rows in macOS Terminal
- How to identify installed Java (JDK) Version on macOS
- Keyboard Shortcut to delete a file on a Mac [Macbook]
- Open Docker from Terminal Command on Mac
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to take a screenshot on a Mac - updated for Ventura 13 [updated 2023]
- ls: .: Operation not permitted - Mac Terminal ZSH Error
- How to remove username from Mac Menu Bar?
- macOS Ventura XCode Command Line Tools Installation
- Where is .zshrc file located in macOS
- How to Show Path of Files or App in Mac Spotlight Search
- How to enable root user on Mac Terminal
- Install Java 17 (LTS) JDK on ARM based M1/M2 Mac Natively
- Resolve - zsh: command not found: code - zsh
- [Fix] java: incompatible types: java.lang.String cannot be converted to int - Java
- How to reload zsh shell profile file? - zsh
- Microsoft Edge browser error on MAC - This page is having a problem Try coming back to it later - Microsoft
- ADT quit unexpectedly error on Mac OSX Android Eclipse SDK - Android
- How to SFTP to port different than 22 (SFTP Custom port) - FTP
- Generate Maven Project Dependency Tree using MVN Command - Java
- Project JDK is not defined [IntelliJ IDEA] - Java