Skip to content

SIRF SuperBuild on MacOS

Kris Thielemans edited this page Jun 18, 2024 · 28 revisions

These instructions have undergone limited testing and are probably out-of-date. You might want to check our page when using conda for dependencies instead.

This is a page under construction with instruction how to install the SIRF SuperBuild on Mac OS. It is based on the Gadgetron Wiki page on Mac OS installation and also uses XCode and Homebrew.

Please check also our pages with specific instructions for SIRF and Python.

Table of Contents

  1. Install XCode and Homebrew
  2. Set environment variables
  3. Install dependencies
  4. Install the SIRF SuperBuild
  5. Optionally install ISMRMRD Python Tools

1. Install XCode and Homebrew

Follow first three steps on the Gadgetron Wiki to install Xcode and Homebrew.

2. Set environment variables in ~/.bash_profile or its equivalent

# Put homebrew paths first
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

3. Install dependencies

If already installed, they can be upgraded by replacing brew install with brew upgrade.

    brew install wget cmake glew ace qt boost

Assuming you will want to use python, we recommend brew and pip, but see a list of instructions for alternatives here

    python -m pip install -U docopt nose codecov coveralls
    python -m pip install numpy scipy matplotlib numpy scipy matplotlib

Note that you might have to add the --user option after pip install depending on your permissions.

Check if your CMake version is at least 3.12. Otherwise download and install a recent version. Older versions may not find the relevant packages (e.g., hdf5).

The SuperBuild will compile many dependencies (which takes time). If you prefer, you can brew install some of these (faster) and then tell the SuperBuild to use these versions and not build them itself (see the Advanced Installation instructions for more information on this):

    brew install fftw swig armadillo
    brew install hdf5 --enable-cxx 

Optionally, you can install extra libraries that will give you more features for Gadgetron (but that are not currently used by SIRF):

    brew install libxml2 --with-python 
    brew install dcmtk doxygen docbook-xsl fop
    python -m pip install h5py PyXB

Optionally install MKL, see our separate page including some info on harmless warnings you will get if you don't install MKL.

Upgrade Boost

Ensure that your version of Boost is up to date by running brew upgrade boost.

4. Install the SIRF SuperBuild

Follow the SuperBuild README.md to install the SIRF-SuperBuild. Unfortunately, on MacOSX it is quite common to have problems with conflicting Python versions and you will likely have to tell the SuperBuild which Python version you want to use. Please refer to the MacOS section of the SIRF and Python page.

Once this is done, things should run smoothly but will take a while.

As opposed to running CMake with default options, you could run cmake-gui to select some options, for instance to use some brew packages as mentioned above. (If cmake-gui is not available, then try brew cask install cmake (with the cask), to allow brew to do this install, you may also need to remove the Cmake.app from your /Applications folder if CMake has been separately downloaded.)

At some point in the past, there was an issue with googletest (gtest) and installed libraries. Here is some info on that

Cmake results in an attempt to link with gtest libraries in your /usr/local/lib/ if they exist. If you have previously followed the MacOS instructions for installing Gadgetron, you will have libgtest.a and libgtest_main.a from release 1.7 of gtest in your /usr/local/lib/. When linked with the gtest compiled as part of SIRF, you may get an error. A work around is to move libgtest.a and libgtest_main.a out of your /usr/local/lib/.

5. Optionally install ISMRMRD Python Tools

    git clone https://github.com/ismrmrd/ismrmrd-python-tools
    cd ismrmrd-python-tools
    python setup.py --user install

Make sure you use the same python executable as the one you used to build of course.