Dependency setup for Mac OSx - El Capitan

Mar 02, 2016

Installation instructions for Underworld dependencies within OSX 10.11.x environment

This guide is for those wanting to use Underworld from its source code - i.e. NOT under the docker environment ( see the previous post ).

Here we will use the homebrew package manager to install most of the compiled packages and then use pip to install the python dependencies.

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

1) Install/Update Xcode with command-line tools

(From app store)

Run it once to accept the license, then quit To install xcode command-line tools go to a terminal and run

$ xcode-select --install

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, a version of homebrew will need to be installed.

To install homebrew.

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now, to check if there is anything on the system that needs fixing before moving on to install packages, run and follow its advice:

$ brew doctor

See here for further details the homebrew package manager.

3) Install dependencies via homebrew

Use homebrew to install the following packages

$ brew install homebrew/science/petsc
$ brew install python
$ brew install libpng
$ brew install swig

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

Add an environment variable to point to the (proxy) petsc installation. Most likely you’ll want this in your ~/.profile shell script.

$ export PETSC_DIR=/usr/local/opt/petsc
$ echo "export PETSC_DIR=/usr/local/opt/petsc" >> ~/.profile

Again check if homebrew is in order.

$ brew doctor

4) Install python dependencies via pip

For python dependencies we recommend using virtualenv to cleanly isolate Underworld2 dependencies from your system’s python packages. This is NOT required but is our practice for development.


The following initialises a virtualenv called venv in the current directory and activates it. If it was successful your prompt prefix will have changed to (venv)

$ pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate

Tip - to exit the virtualenv

$ deactivate

Most likely you’ll want to enter this python virtualenv in your ~/.profile shell script

$ echo "source `pwd`/venv/bin/activate" >> ~/.profile

See here for more information on virtualenv


$ pip install scipy
$ pip install matplotlib
$ pip install jupyter
$ pip install mpi4py

5) Obtain the Underworld source code

$ git clone https://github.com/underworldcode/underworld2 my_uw

See installation details my_uw/README.md