Skip to main content
Last updated March 07, 2013 19:16, by arkangelofkaos

Building OpenJDK on the MacOS

In case you are running an OS other than OS X Lion or OS X Mountain Lion please check for minimum upgrade possibilities to either of the OSes:

 Mountain Lion:

  • Java 7 for Mac OS X

First check if you have the correct version of Java installed on your system, Java 7 is required in order to build the OpenJDK system. Check your current version of Java on your Mac using the instructions under the Check the default version of java in the Build page.

If your system has one of the two OSes, but you don't have Java 7 installed please visit Oracle's website to download the latest version from:

Accept the License agreement and download the Mac OS X JDK 1.7…dmg file. Install the .dmg by double clicking on it.

  • Install XCode

Download XCode 4.6 from (look for the typical mac-blue [Download XCode] button on the left hand panel) 

Please note this file is approx 1.6 GB in size (depending on your OS type), unless you have access to a high-speed bandwidth internet connection, its best to install it off a MacOS X DVD.

After it has been downloaded, install XCode in the usual manner on the Mac.

Once the installation is finished, start Xcode from the Application folder. And in Xcode go to the Xcode > Preferences section and select Command Line tools and click on Install (this provides the necessary GCC, Make and other commands to proceed with the build process).

  • CCache for Mac

Note: Ccache helps improve build performance but installing it is optional.

 Download the source for CCache 3.0 from 
 Untar/unzip the tar/zip file.
 Go into the source folder.
 Build the source by running the sudo configure command first, then the sudo make install. If necessary run bash to run the test-suite.
 Check if ccache is installed by running ccache at the prompt to see the usage text. 
  • MacPorts

MacPorts do not need to be installed in order to build the OpenJDK system on the Mac.

  • XQuartz (X11 libraries)

For OSX 10.6 and later, you may require XQuartz. The auto configure tool will inform you if this is the case:

 configure: error: Could not find X11 libraries. 
 configure exiting with result code 1

Download XQuartz here:

Simply installing XQuartz should resolve this issue.


See the Auto Configure section for Debian/Ubuntu's to find steps for the configure process. A successful run of the configure command results in the below output:

 A new configuration has been successfully created in /Users/openjdk/sources/jdk8_tl/build/macosx-x86_64-normal-server-release using default settings.
 Configuration summary:
 * Debug level:    release
 * JDK variant:    normal
 * JVM variants:   server
 * OpenJDK target: OS: macosx, CPU architecture: x86, address length: 64 
 Tools summary:
 * Boot JDK:       java version "1.7.0_12-ea" Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b08) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b28, mixed  mode)  (at /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home)
 * C Compiler:     i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build) version 2336.11.00) (at /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2)
 * C++ Compiler:   i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build) version 2336.11.00) (at /usr/llvm-gcc-4.2/bin/llvm-g++-4.2)
 Build performance summary:
 * Cores to use:   2
 * Memory limit:   2048 MB
 * ccache status:  installed and in use
 WARNING: The result of this configuration has overridden an older configuration. You *should* run 'make clean' to make sure you get a proper build. Failure to do so might result in strange build problems.

See the Make Images page to find steps for the make process.

Other references

(The instructions in the below links have not been tested by the writers of the wiki instructions)

Next Step

Please Confirm