Difference between revisions of "Installing on a MAC"

From Quantlib
Jump to: navigation, search
(TlrHgeMgRKuB)
(Undo revision 78 by 122.200.59.85 (talk))
 
Line 1: Line 1:
I am ttolaly wowed and prepared to take the next step now.
+
'''To Install Quantlib on a MAC'''. <br>
 +
First get macports(porticus is a nice gui to use) and install boost(and dependents).
 +
1) To install boost(in terminal)<br>
 +
 
 +
sudo port install boost<br>
 +
Boost should install in /opt/local by default.<br>
 +
 
 +
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.

Latest revision as of 00:48, September 26, 2012

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.