Installing on OS X

Installing on MAC OS X with MacPorts

In this section we asume a clean MacPorts installation. The MacPorts build system will build every package from source so installation will be slow. The packages in MacPorts support different variants, each variant is build differently. The default variant of most packages does not support fortran and AMUSE needs fortran and fortran enabled packages. Below, with all installation commands we will specify the variant. AMUSE is tested with the gcc49 variant; gcc43, gcc44 and gcc45 have been known to work also. Below, we will use gcc49.


If you want to use a different fortran compiler (ifort), you are better of using the script in the doc/install directory.


Make sure you have a recent MacPorts installation. You need at least an up to date MacPorts 1.8.6 or later.


If you are unsure of your installation you can uninstall and clear the packages with:

port uninstall py27-docutils py27-nose py27-mpi4py py27-h5py py27-numpy hdf5-18 fftw-3 gsl openmpi python27

To make a clean install of MacPorts, please remove the MacPorts directory and read the guide at:

All in one

You can install all the packages described below in one go with:

> sudo port install gcc49

> sudo port install python27
> sudo port install openmpi-gcc49
> sudo port install fftw-3 +gcc49
> sudo port install hdf5-18 gsl cmake gmp mpfr
> sudo port install py27-numpy py27-h5py py27-nose py27-docutils +gcc49

> sudo port install py27-mpi4py +openmpi

> sudo port install py27-matplotlib +gcc49

After installing you will need to configure the code with the following line:

> ./configure --with-fftw=/opt/local \
              MPICXX=mpicxx-openmpi-gcc49 MPICC=mpicc-openmpi-gcc49 \
              MPIFC=mpif90-openmpi-gcc49 \
              FC=gfortran-mp-4.9 PYTHON=python2.7 \


The --with-fftw option will ensure that fftw is found in /opt/local and not in any other location on OS X. Often, incompatible versions of fftw will be installed in /usr/include or /usr/local/inlude. These versions may have the wrong processor type (32 vs 64bits) or not contain a fortran API. For both cases compiling Fi will fail. In case the configure script does not pick the wanted fftw directories, you can edit the file to point to the right version.


The PREFIX variable will make sure some support libraries for community codes (gsl, gmp and mpfr) are found in /opt/local.


Please, make sure you have no other compile variables specified (like CC or CXX or CFLAGS), unless you have customized MacPorts in any way. Some variable settings will likely give compile errors for the community codes.

For example, BHTree is compiled with openmpicxx and $CXX. The command in the CXX variable must be compatible with openmpicxx (you can do openmpicxx --show to get the command openmpicxx is using)


The version of openmpi in macports (1.5.5 and before) does not handle MPI_IN_PLACE calls correctly for Fortran codes. Unfortunately, this means that Capreole, PhiGrape and Mocassin will not work with more than one worker on the mac. Also, MpiAmrVac, will give incorrect results in any case.

If you want to run these codes on OS X, please use the amuse install scripts and make sure macports is not on your path.


With macports, the nose package will not install nosetests under it’s standard name. It will be named nosetests-<python-version>. So for python2.7 you’ll need to use nosetests-2.7

> nosetests-2.7



By default MacPorts uses the XCode compilers, these compilers have no support for fortran, a MacPorts gcc compiler set needs to be installed. We suggest installing gcc 4.9:

> sudo port install gcc49


If you have installed a different version of gcc, you need to select a different variant of the packages below. To select a different variant replace +gcc44 with +gcc43, +gcc42 or any other version matching your gcc installation. Note, apple-gcc versions will not work, these do not support fortran.


MacPorts supports several python versions in different variants, we will install the python27 versions

> sudo port install python27 +gcc49


MacPorts provides packages for mpich2 and openmpi. Although you can probably install both, this is not recommended. We suggest you install openmpi.

To install openmpi, do:

> sudo port install openmpi +gcc49


Amuse can work with HDF5 versions 1.6.* and 1.8.3. MacPorts comes with HDF5 version 1.8.*. To install it, do:

> sudo port install hdf5-18 +gcc49


MacPorts comes with a FFTW and FFTW-3 package, for AMUSE we need FFTW-3. FFTW-3 can be installed with:

> sudo port install fftw-3 +gcc49


GSL is used to build Gadget2, GSL can be installed with:

> sudo port install gsl +gcc49


CMake is used to build EVTwin, CMake can be installed with:

> sudo port install cmake


GMP is required for Adaptb. With MacPorts, GMP can be installed with:

> sudo port install gmp


MPFR is required for Adaptb. With MacPorts, MPFR can be installed with:

> sudo port install mpfr

Python packages

By this point all libraries and frameworks are installed. We can now install python packages (some depend on the installed libraries):

> sudo port install py27-numpy py27-h5py py27-nose py27-docutils +gcc49

If you installed openmpi in the MPI2 step you need to set the “openmpi” variant for “py27-mpi4py”:

> sudo port install py27-mpi4py +openmpi


Matplotlib is not required but is very useful for creating graphics, you can install it with:

> sudo port install py27-matplotlib +gcc49


Macports will install the compilers under non standard names. To use the right compilers you need to specify these during the configure stage of AMUSE.

See the output for configure --help for a list of all environment variables you can set.

If you installed openmpi you need to specify the mpi compilers like so:

./configure MPICXX=openmpicxx MPICC=openmpicc MPIFC=openmpif90