Installing OR-Tools for Java from Binary on MacOS


This guide explains how to install OR-Tools for Java on MacOS.

Although these instructions might also work on other MacOS variants, we have only tested them on machines meeting the following requirements:

  • MacOS 11.2.1 (Big Sur) 64-bit (x86_64)

Xcode Command Line Tools

You must install the Xcode Command Line Tools. To do so, open the Terminal, found in /Applications/Utilities/, and enter:

xcode-select --install

Click “Install” to download and install Xcode Command Line Tools. You don’t need to "Get Xcode" from the App Store. If you have a slow Internet connection, it may take many minutes.

Verify that you’ve successfully installed Xcode Command Line Tools:

xcode-select -p

You should see:


Prerequisite: Java JDK

You must install the Java JDK 7.0 or higher. We recommend installing it using the "missing package manager for macOS" aka Homebrew:

/usr/bin/ruby -e "$(curl -fsSL"
brew update

Once you have installed Homebrew, you can install Java JDK using:

brew cask install java

Installing OR-Tools

Take the following steps to install the OR-Tools library for Java:

Download and extract the binary distribution for your system:

FlatZinc binary distributions

FlatZinc is a solver input language understood by a wide range of solvers.
OR-Tools also provides binary distributions with FlatZinc support:

Validate your installation

To test your Java installations, open a terminal window and navigate to the directory where you unpacked the binary distribution. Then enter the following command:

make test_java

This runs a selection of examples for OR-Tools. If all the examples run successfully, you are ready to get started with OR-Tools.