Before compiling MiniZinc, consider whether you want to install additional solvers. In particular, MIP solvers such as CBC, SCIP, Gurobi, IBM ILOG CPLEX, and XPRESS need to be installed prior to compiling MiniZinc, so that the build system can find them. If you want to use the solution checking functionality or extended presolving, you will also need to install Gecode before compiling MiniZinc. See below for installation instructions for these solvers.

To install MiniZinc, unpack the source code (or clone the git repository). Open a terminal and change into the source code directory. The following sequence of commands will build the MiniZinc compiler tool chain:

You can obtain the Gecode source code from GitHub (https://github.com/gecode/gecode). You can find detailed compilation instructions for Gecode on its web site (https://www.gecode.org). In short, to compile from source, run the following in a terminal (from within the Gecode source code directory):

mkdir build
cd build
../configure
make -j8
sudo make install

which compiles Gecode and installs it in the standard location. You can choose a different installation directory using ../configure --prefix=. In that case you can run make install without sudo.

After installing Gecode, you can compile MiniZinc with built-in support for Gecode, which enables extended pre-solving and solution checking. In order for the MiniZinc compilation to find your Gecode installation, Gecode either has to be in the default location (such as /usr/local/include etc.), or you have to use the option -DGECODE_ROOT= when calling cmake.

In order to use Gecode as a solver with MiniZinc (as opposed to an internal pre-solving tool), you have to create an appropriate solver configuration file. Add a file gecode.msc in an appropriate location (see Solver Configuration Files) containing the following, where you replace with the actual installation path and update the version number if necessary:

In order to use OR-Tools with MiniZinc, you have to create an appropriate solver configuration file.
Add a file ortools.msc in an appropriate location (see Solver Configuration Files) containing the following,
where you replace with the actual installation path and update the version number if necessary:

This will install Chuffed in the default location. Alternatively, you can choose a different installation directory by calling cmake .. -DCMAKE_INSTALL_PREFIX= before cmake --build. In that case, you may be able to install without using sudo.

In order for MiniZinc to recognise the Chuffed solver, add a configuration file chuffed.msc to an appropriate location (see Solver Configuration Files) with the following content, where you replace with the actual installation path and update the version number if necessary:

CBC is an open-source Mixed Integer Programming solver. You can find out more about it at https://github.com/coin-or/Cbc. MiniZinc contains a built-in interface to CBC, so in order to use it you have to install CBC before compiling MiniZinc.

This will install CBC in the default location. You can choose a different installation directory using ../configure --enable-cbc-parallel --prefix=. In that case you can run make install without sudo.

The MiniZinc build system should find CBC automatically if it is installed in the default location. You can use the command line flag -DOSICBC_ROOT= when running cmake for MiniZinc if you installed CBC in a different location.