Last modified on September 26, 2012, at 00:48

Installing on a MAC

To Install Quantlib on a MAC.
First get macports(porticus is a nice gui to use) and install boost(and dependents). 1) To install boost(in terminal)

sudo port install boost
Boost should install in /opt/local by default.

2) Then download quantlib. You want to download the tar.gz package and extract it

tar -xzvf QuantLib

3) To install QuantLib(in terminal)

./configure -enable-static –with-boost-include=/opt/local/include/ –with-boost-lib=/opt/local/lib/ –prefix=/opt/local/

4) And at last

make && sudo make install

5) And then try to compile the examples(terminal). For example

g++ -I /opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp -o bermudanoption -L/opt/local/lib/ -lQuantLib

6) Edit ~/.bash_profile, add the following lines into the file

export CPLUS_INCLUDE_PATH=/opt/local/include export C_INCLUDE_PATH=/opt/local/include export DYLD_LIBRARY_PATH=/opt/local/lib

When this is done, restart the terminal, no Include or Link directory needs to be specified when compiling with g++.

Note: the whole process takes two hours if installing both boost and QuantLib.