How to Install Boost on MACos

How do you install Boost on MacOS?

Download MacPorts, and run the following command:

sudo port install boost 

how do i install boost on my mac?

You might use macports which simplifies the installation of boost significantly.

  1. Download macports from http://www.macports.org/

  2. Run sudo port install boost
    This will download an install boost automatically. And also install all dependencies of boost.

  3. Wait until boost is compiled. Takes about 0.5h on my macbook pro.

  4. Your boost library is then found at /opt/local/include/boost

How to install boost in OSX

You need to add the location of the include path in the compile command (this is where header files would be located). Often the compile command needs to have the include path, and would be similar to this:

g++ -I/usr/local/include test.cpp

However, the standard include path location above might not be the correct location, since on step (5):

The following directory should be added to compiler include paths:

/Users/lvzhi107/Downloads/boost_1_57_0

So in that case you would likely use:

g++ -I/Users/lvzhi107/Downloads/boost_1_57_0 test.cpp

If you encounter the same error again it might be recommended to step back and read the documentation more in depth, or perhaps use another means of installing boost such as MacPorts.



Related Topics



Leave a reply



Submit