Special Instructions for running amatos under Mac OS X

It has been a day long struggle for several times, so here is the (currently) ultimate instruction to get amatos running on a Mac with OS X installed. The following works for OS X El Capitan (10.11.2), but I see no reason, why it should not work under older (at least Yosemite 10.10.n) versions of Mac OS X. We assume you will be using gfortran for the compilation. For details on using Intel's ifort, you may look further down on this page.

Prerequisites for gfortran

First there are a few things that need to be done, and this has always been a hassle for me. So, I try to give detailed instructions, without any warranty as usual. It is important to mention that you will need to have root/administrator access to your computer. We will make use of the command sudo several times and will therefore need super user privileges.

  1. Get Xcode and install it. Xcode is the development environment distributed free of charge through Apple's AppStore. It will provide the following essential components:
    1. make utility for automatically building the library and executables
    2. optimized math libraries in the Accelerate framework (in particular BLAS and LAPACK routines)
    3. clang, a free C language compiler
  2. You should also install the command line tools included in Xcode, but installed in a separate step:
    1. In a terminal window run the command sudo xcodebuild -license after installing Xcode in order to accept the license.
    2. Remaining in the terminal window run xcode-select --install in order to install the command line tools (I am not sure, if this is strictly necessary, but included it here just in case)
  3. Once Xcode is running, we will need to install the fink environment, which allows us to use pre-configured installation packages of useful standard libraries.
    1. Please follow the instructions for fink installation on the fink project homepage.
    2. Once the base components are there you should install the following (Please make sure that the version numbers are current by using the command fink apropos netcdf or fink apropos netpbm):
      1. NetCDF libraries: sudo fink install netcdf-fortran7
      2. netpbm libraries: sudo fink install netpbm11
  4. By default, the fink packages are compiled and stored into the directory tree /sw, so you might want to check if libnetcdff.dylib is in directory /sw/lib. Otherwise have a look at where the installation directory for fink packages is on your machine.
  5. In principle, fink does install a gfortran version, in order to generate the fortran interfaces of NetCDF. However, I preferred to install the clean gfortran from the gcc project homepage

Please note that these five steps may well take two hours of time to accomplish, even if everything works out smoothly. So, you should not be in a hurry...

Prerequisites for ifort

The Intel fortran compiler is a commercial product, but University of Hamburg has a floating license that can be used by members of the university. Instructions on how to access the license server from outside the university campus (only for members of the university) can be found here. Of course the Intel Fortran compiler (called composer) needs to be installed.

  1. It is also necessary to install the Xcode environment, so see the prerequisites for gfortran above for this part.
  2. Proceed as above with the fink installation and install the NetCDF and netpbm packages (and corresponding requirements).
  3. I found that the fink NetCDF installation does not work with the Intel compiler, since the Fortran modules generated by the fink provided gfortran are not compatible with ifort. However, the C language bindings are usually working with the Intel environment. So, it is usually enough to compile the Fortran interfaces for NetCDF. In order to do so, follow these steps:
    1. Download the NetCDF Fortran source files from the Unidata download page
    2. Follow the instructions to compile those, for me it worked with
      1. specifying export FC=ifort
      2. specifying ./configure --prefix=${NFDIR}, where NFDIR=/usr/local was set before
      3. installing by issuing the install command with sudo make install

This should mostly do it.

amatos installation

Now, you may change into the amatos directory and follow the instructions given for amatos installation in general. There is a compile directory called macosx_gfortran (or macosx_intel for the Intel ifort compiler), which contains a Makefile that you may check out. Usually it is enough to correct the paths for your own environment.