How do I install on MacOS ?

Louis Moresi

Oct 06, 2015

Installation instructions for 10.10.x and 10.11.x

These are some pretty bare-bones installation notes for MacOS. We rely on the homebrew package manager to install most of the compiled packages and we use pip to install our python dependencies.

Everything other than installation of Xcode requires access to the terminal.

1) Install/Update Xcode

(From app store)

Run it once to accept the licence, then quit

2) Install/Update homebrew

If this is a machine that is being upgraded from a previous major release of the OS then it is safest to start afresh with the homebrew packages as it seems difficult to ensure that all of the dependencies are properly managed across the upgrade.

brew update
brew remove --force $(brew list)

If this is a brand new machine or a clean installation of the OS, note, that /usr/local does not exist on a new machine and it can be tricky to create it. The details are here on the homebrew github page and we recommend checking them carefully since things are likely to change. You may need to revisit these instructions after each system-software update.

To install homebrew into /usr/local

ruby -e "$(curl -fsSL"

Now, to check if there is anything on the system than needs fixing before moving on to install packages, run:

brew doctor

3) Install dependencies via homebrew

You probably need to run

brew tap homebrew/science
brew tap homebrew/x11

and then install the following packages

brew install python
brew install petsc
brew install libpng
brew install libxml2
brew install freeglut
brew install swig

(Some of these have many dependencies of their own so this can take several minutes )

4) Install python dependencies via pip

pip install numpy
pip install scipy
pip install matplotlib
pip install jupyter

5) Obtain u/w source

The installation path for underworld is not especially important but you can specify it explicitly at this stage:

git clone ~/underworld2-2015.10.01

6) Configure & Build

Set the environment variables for PETSC. brew info PETSC will tell you the value required for $PETSC_DIR. Use this value since the version in /usr/local/opt is incomplete.

git clone ~/underworld2-2015.10.01
export PETSC_DIR=/usr/local/Cellar/petsc/3.6.1_3/real # for example !

The following may be necessary:

export HDF5_DIR=/usr/local/opt/hdf5
export LIBXML2_DIR=/usr/local/opt/libxml2
export LIBPNG_DIR=/usr/local/opt/libpng
export PYTHON_DIR=/usr/local/opt/python/Frameworks/Python.framework/Versions/Current

Then the actual compilation and python linking

cd ~/underworld2-2015.10.01
cd libUnderworld
cd libUnderworldPy
cd ..

There will be many warnings

7) Did it work ?

Go back to the underworld directory

cd ~/underworld2-2015.10.01

Fire up ipython and see if it works

import underworld as uw

You should see in response:

Toolbox "StgDomain" found using ...
Toolbox "StgFEM" found using ...
Toolbox "PICellerator" found using ...
Toolbox "Underworld" found using ...
Toolbox "gLucifer" found using ...
Toolbox "Solvers" found using ...

Help on package underworld.mesh in underworld:

underworld.mesh - Implementation relating to meshing.



The paths on your system to the various toolboxes will be spat out in the preamble text “found using ...