Install OpenJDK on Mac
How to install OpenJDK on Mac. Download the free, certified JDK for Java on macOS. Compare licensing and vendors. Easily install OpenJDK with Homebrew.
OpenJDK is the official reference implementation of the open-source Java Development Kit (JDK) that contains the Java language libraries and developer tools you will use to build Java software applications. This guide explains what OpenJDK is, why it's the right choice over Oracle JDK, and how to get it installed quickly.
Before you get started
You'll need a terminal application to develop with OpenJDK. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and makes coding easier when working with Java.
What Is OpenJDK?
Sun Microsystems developed the Java programming language and the Java Virtual Machine (JVM) in the early 1990s. In 2010, Oracle acquired Sun Microsystems and the Java trademark. Oracle makes a Java JDK available to its enterprise customers but OpenJDK is freely available for anyone to use and it's more popular with developers.
OpenJDK is not an alternative or knockoff. It's the same authoritative Java implementation that Oracle and other major tech companies build from. Since Java SE 7, Oracle has designated OpenJDK as the standard against which all Java implementations are measured.
OpenJDK is available under GPLv2 license terms. This license structure is specifically designed for developers: you can use OpenJDK to build and run commercial applications without paying licensing fees or worrying about copyleft restrictions on your own code. The license terms include a Classpath Exception which explicitly permits linking proprietary applications with OpenJDK libraries.
Netflix, Amazon, and Microsoft all run production workloads on OpenJDK distributions. Industry surveys show over 60% of production Java workloads run on OpenJDK. When you install OpenJDK, you're using the same Java that powers some of the largest systems in the world.
What You're Actually Installing
When you "install Java" on macOS with OpenJDK, you're installing everything you need for Java development:
- java — runs Java applications
- javac — compiles source code to bytecode
- jshell — interactive environment for testing code snippets
- jar — packages applications into archives
- javadoc — generates documentation from source code
- jdb — debugger for troubleshooting
Historically, end users installed a separate JRE (Java Runtime Environment) just to run Java apps. Modern distributions ship as full JDKs, so everyone gets development tools even if they only need the runtime. A modern JDK adds roughly 100-150 MB beyond what a JRE would have included. The extra space contains the compiler (javac), debugging tools, and development libraries that sit unused if you only run Java applications. For most users with modern storage, this overhead is negligible.
OpenJDK vs Oracle JDK
OpenJDK and Oracle JDK share the same codebase. Since Java 11 (September 2018), Oracle has built its commercial JDK directly from OpenJDK source. The two are functionally equivalent. Performance benchmarks show them within 5% of each other, with neither having a consistent advantage.
Before 2019, Oracle JDK offered features that were exclusive to Oracle, including Java Flight Recorder, Mission Control, and other commercial tools. These are now open-sourced. There's no technical reason to choose Oracle JDK over OpenJDK.
Why Licensing Matters
The critical difference is licensing. Oracle JDK requires expensive subscriptions for commercial production use. Their January 2023 pricing model introduced employee-based pricing based on company size. Oracle charges per every employee in an entire organization, not per Java user. Organizations have reported cost increases of 700% or more under this model.
Oracle Java SE Subscription Pricing
- 1–999 employees – $15.00 per employee monthly ($90,000 annually for 500 employees)
- 1,000–2,999 employees – $12.00 per employee monthly ($72,000 annually for 500 employees)
- 3,000+ employees – $8.25–$10.50 per employee monthly (scales significantly)
Oracle actively audits Java usage. Using Oracle JDK in production without proper licensing creates compliance risk.
Why Choose OpenJDK
OpenJDK eliminates licensing risk entirely. It's free for any use, including development, testing, production, commercial, or personal use. There are no per-seat fees, no employee counts, no audits, and no subscriptions. The software is identical; only the licensing differs.
What Is TCK Certification?
The Technology Compatibility Kit (TCK) is Oracle's official test suite that verifies a Java implementation is truly compatible with the Java specification. When a distribution is "TCK-certified," it means the build has passed 100% of these rigorous compatibility tests.
The TCK contains over 139,000 individual tests covering every aspect of the Java specification. A TCK-certified build guarantees that your Java code will run exactly as the specification intends. It's a verified commitment to compatibility.
All reputable OpenJDK distributions are TCK-certified:
- Eclipse Temurin — TCK-certified, plus additional AQAvit quality testing
- Azul Zulu — TCK-certified
- Amazon Corretto — TCK-certified
- Microsoft Build of OpenJDK — TCK-certified
- BellSoft Liberica — TCK-certified
When you install any of these distributions, you can trust that your Java applications will run correctly. The certification process ensures there are no hidden incompatibilities.
Choose a Distribution
OpenJDK is a source code specification but you need a vendor's distribution version, which is a vendor's compiled and tested build of the source code. Similar to Linux, the Linux kernel is open source, but you install a vendor's distribution like Ubuntu or Fedora. For Java, all major OpenJDK distributions are built from the same codebase and are functionally identical.
Recommended Distribution: Eclipse Temurin
Eclipse Temurin is my recommendation for most developers. Temurin comes from the Eclipse Adoptium project, a vendor-neutral foundation backed by Microsoft, Red Hat, IBM, Google, Azul, and Alibaba. It's the most widely recommended distribution in the developer community. For specific use cases, other distributions may fit better, for example, AWS deployment, JavaFX needs, or Azure development.
Read Install JDK on Mac for a detailed comparison of all distributions and when to choose each one.
Choose a Version
Java releases follow a predictable schedule: a new version every six months, with Long-Term Support (LTS) versions every two years. LTS releases receive security patches and bug fixes for years; non-LTS releases get updates for only six months.
Recommended Version: OpenJDK 25 LTS
Java 25 is the latest version. It's the current LTS release with support until at least September 2033. Most frameworks and tools now fully support Java 25. Use the latest version for new projects, unless your team or your university course requires an older version.
Compare Java 21 to Java 25 for a detailed comparison between the two newest LTS versions.
Version Support Timeline
- Java 25 – LTS, Adoptium support until September 2033, default choice for new projects
- Java 21 – LTS, Adoptium support until December 2029, for projects that haven't migrated to 25 yet
- Java 17 – LTS, Adoptium support until October 2027, for legacy projects with older dependencies
- Java 11 – LTS, Adoptium support until October 2027, for older legacy projects
- Java 8 – LTS, Adoptium support until December 2030, for ancient legacy systems only
If your project or your university course requires a specific version, install that version. Otherwise, go with Java 25.
Read Install Java 25 on Mac for version-specific installation details.
OpenJDK Installation with Homebrew
Homebrew is the easiest way to install the JDK on Mac. You have two approaches: the cask method (recommended) or a formula method. The Homebrew cask installation sets up the JDK so macOS discovers it automatically with no extra configuration. Homebrew automatically downloads the correct architecture for Apple Silicon or an Intel processor, so you don't need to specify it manually.
Read Brew Install Java - Cask Method for complete installation details and troubleshooting. Here are condensed instructsions.
Verify Homebrew is working. Learn How to Open Terminal in Mac and run:
$ brew --version
If you get "command not found," install Homebrew first. See Zsh: command not found: brew if you think Homebrew is already installed. Otherwise, see our instructions to Install Homebrew.
Where Java Lives on macOS
Apple's macOS discovers Java installations in /Library/Java/JavaVirtualMachines/. When you type java in Terminal, macOS routes the command through a stub at /usr/bin/java that checks this directory. Apple's /usr/libexec/java_home utility manages which JDK is active.
The Homebrew cask installation puts the JDK directly in this location, so macOS discovers it automatically with no extra configuration.
Here's how to install Eclipse Temurin JDK 25 using Homebrew's cask method. Run this single command to install:
$ brew install --cask temurin@25
The cask installs the JDK to /Library/Java/JavaVirtualMachines/, where macOS discovers it automatically. Verify the installation:
$ java -version
You should see output showing OpenJDK and the Temurin distribution. Both java and javac commands will work immediately without additional configuration required.
Configure JAVA_HOME
Development tools such as Maven, Gradle, IntelliJ IDEA look for the JAVA_HOME environment variable to find the JDK. While the Homebrew cask installation makes Java available immediately, setting JAVA_HOME ensures all your tools work correctly.
The recommended approach uses Apple's java_home utility to set the variable dynamically in your shell configuration:
export JAVA_HOME=$(/usr/libexec/java_home)
Read Set JAVA_HOME on Mac for complete configuration instructions, multiple version management, and troubleshooting.
Apple Silicon or Intel Macs
If you have an M1, M2, M3, M4, or M5 Mac, native ARM64 builds run significantly faster than older Intel builds. All major distributions provide native Apple Silicon builds for Java 11, 17, 21, and 25.
The Homebrew cask installation automatically downloads the correct architecture for your Mac. One exception: Eclipse Temurin doesn't provide ARM64 builds for Java 8. If you need Java 8 on Apple Silicon, use Azul Zulu or Amazon Corretto instead.
Read Java on Apple Silicon or Intel Macs if you have an Intel Mac or need JDK 8 options.
Common Questions
Is OpenJDK Really Free?
Yes, OpenJDK is open source under the GPLv2 license with Classpath Exception. There are no licensing fees for development, testing, or production use. There are no restrictions on commercial use, no subscriptions or aduits.
Is OpenJDK Production-Ready?
Yes, OpenJDK is used by the biggest tech companies. Netflix runs 2,800+ Java microservices on OpenJDK. Amazon uses Corretto across thousands of internal services. Microsoft runs OpenJDK in Azure, LinkedIn, and Minecraft. Industry surveys show over 60% of production Java workloads run on OpenJDK distributions.
What Does TCK-Certified Mean?
The Technology Compatibility Kit (TCK) is Oracle's official test suite with over 139,000 tests verifying Java compatibility. A TCK-certified build has passed 100% of these tests, guaranteeing correct Java behavior. Eclipse Temurin, Azul Zulu, Amazon Corretto, and other reputable distributions are all TCK-certified.
How Do I Get Support?
Free community support is available from the Eclipse Adoptium Slack, GitHub issues, Stack Overflow, and OpenJDK mailing lists.
Commercial support is available. Red Hat offers support for Temurin. Azul supports Zulu. IBM supports Semeru. These options cost far less than Oracle's subscription model.
What's Next
Now that OpenJDK is installed, you can start developing Java applications:
- Set up your IDE — Configure IntelliJ IDEA, VS Code, or Eclipse to use your new JDK
- Install build tools — Set up Maven or Gradle
Read Java Version Managers if you need to switch among Java versions frequently.
My mac.install.guide is a trusted source of installation guides for professional developers. Take a look at the Mac Install Guide home page for tips and trends and see what to install next.