Skip to content

Latest commit

 

History

History
91 lines (62 loc) · 3.18 KB

INSTALL_MAC.md

File metadata and controls

91 lines (62 loc) · 3.18 KB

Installation on Mac OS X

LibBi can be installed on Mac OS X by using Apple's Xcode and a package manager such as Homebrew or MacPorts. The recommended package manager is Homebrew---we find that it "just works" with no additional configuration required---but instructions for MacPorts are included below also.

Step 1: Install Xcode

The easiest way to install Xcode is via the Mac App Store. Once installed, launch it and use the Xcode > Preferences menu item to install the Command Line Tools package. This will give you some of the basics required by LibBi.

Step 2 (optional): Install CUDA

If you have a CUDA-enabled GPU and would like LibBi to be able to use it, you must also download and install the CUDA Toolkit https://developer.nvidia.com/cuda-toolkit.

Step 3: Install LibBi

Option 1 (preferred): Using Homebrew

First install the Homebrew package manager using the instructions here. Then simply run the following command from a terminal window to install LibBi:

brew install libbi

Option 2: Using MacPorts

Step 3a: Install Thrust

If CUDA is not installed, it is necessary to install Thrust (this is not necessary if using the Homebrew route described above, as this will automatically download Thrust). If CUDA is installed, Thrust is already included with it, and need not be installed separately.

To install Thrust:

wget https://github.com/thrust/thrust/releases/download/1.8.2/thrust-1.8.2.zip
unzip thrust-1.8.2.zip
sudo mv thrust /usr/local/include

Step 3b: Install MacPorts and dependencies

LibBi has also been successfully installed with MacPorts instead of Homebrew. This seems more difficult, in that (a) it is necessary to edit environment variables in your ~/.profile file, and (b) it can take much longer to install dependencies. Nevertheless MacPorts may be preferable, especially if you already have a working installation of it.

Install the MacPorts packages on which LibBi depends:

sudo port install autoconf automake netcdf qrupdate atlas boost gsl

To ensure that LibBi can find the gfortran libraries, symlink them into the /opt/local/lib directory:

sudo ln -s /opt/local/lib/gcc45/libgfortran.a /opt/local/lib/.
sudo ln -s /opt/local/lib/gcc45/libgfortran.dylib /opt/local/lib/.

Now set up the environment for LibBi to compile its client programs. Firstly, add the following to ~/.profile

export LDFLAGS='-L/opt/local/lib'
export CPPFLAGS='-I/opt/local/include'
export LD_LIBRARY_PATH=/opt/local/lib
export LD_INCLUDE_PATH=/opt/local/include

LibBi needs to use the MacPorts g++ compiler in /opt/local/bin, not the system default g++ in /usr/bin. To do this, set the following environment variable:

export CXX=/opt/local/bin/g++-mp-*

You can put this in ~/.profile too, although keep in mind that all configure scripts that you run will then use this g++, not just LibBi. This may not be a problem. If it is, just enter the above line each time you open a Terminal window.

Quit Terminal then start it again, to ensure that these environment variables are set.

Step 3c: Install LibBi

Now you can install LibBi manually as per the instructions in INSTALL.md.