Background

QuantLib is aimed at providing a comprehensive software framework for quantitative finance. QuantLib is a free/open-source library for modeling, trading, and risk management in real-life[1].

Compile

You can find the doc about how to install QuantLib, but if you have upgraded to El Capitan you might come cross the same issue I had.

It is required to install boost before quantlib installation:

sudo port install boost


If unluckily you don’t have port installed, you can easily find the official sites of MacPorts. As suggested in its home page, you are probably gonna download the pkg installers for El Capitan. Double click, some continue, and bah! It seemed that installation was suspended or blocked by something bizarre, you even didn’t know where to find the problem. For the first time I killed the installation and tried it again. When I came back from kitchen it after ~20 mins, it was done.

Now if you try the run the script indicated in the doc:

sudo port install boost


Bah, you got another error, command not found: port. :(

I thought it was the issue that system variable \$PATH has not include MacPorts, I modified /etc/paths and tried to source it, but it gave the error that it was not allowed to do that.

I have spent too much time on MacPorts and I was about to give up, why I can’t install boost directly without using port? Actually the command below did work!

brew install boost


After several minutes for downloading and installing, boost was installed and configured under /usr/local/Cellar/boost, clean and clear.

Next, just follow the instructions in QuantLib:

tar xzvf QuantLib-1.0.1.tar.gz
cd QuantLib-1.0.1
./configure --enable-static --with-boost-include=/usr/local/Cellar/boost/1.58.0/include/ --with-boost-lib=/usr/local/Cellar/boost/1.58.0/lib/ --prefix=/usr/local/Cellar/boost/1.58.0/
make && sudo make install


Pay attention to the boost path, it would take some time to for make and make install.

[1] QuantLib, http://quantlib.org/index.shtml.