Include boost in xcode Include boost in xcode xcode xcode

Include boost in xcode


I have spent a long time trying to make this work. I could not make it work using the download from the Boost project homepage, so I used homebrew instead:

After homebrew is installed, I installed Boost using:

brew install boost 

or, if you don't have python installed, using:

brew install boost --without-python

Without the --without-python it would not install on my machine.

  1. In XCode (4.3.3), select the project file in the left sidebar (top most), and select it again in the project pane.
  2. Select the Build Settings tab, and select All.
  3. Under Search Paths, add the header search path /usr/local/Cellar/boost/1.49.0/include/ and check the box. The path should now show in the Build Settings.

Now, you can use:

#include <boost/regex.hpp>

or whatever you need from the Boost package.


In case you have boost already installed, use $ brew info boost to get the correct path:

boost: stable 1.60.0 (bottled), HEADCollection of portable C++ source librarieshttps://www.boost.org//usr/local/Cellar/boost/1.60.0_1 (11,139 files, 436.5M) *  Poured from bottleFrom: https://github.com/Homebrew/homebrew-core/blob/master/Formula/boost.rb


I followed henrikstroem's great post, like this:

Install via homebrew, took less than 3 minutes

mac:~ woz$ brew install boost==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/boost-1.57.0.yosemite.bottle.tar.gz######################################################################## 100.0%==> Pouring boost-1.57.0.yosemite.bottle.tar.gz🍺  /usr/local/Cellar/boost/1.57.0: 10572 files, 439Mmac:~ woz$

Create symlink in your homedir

mac:~ woz$ cdmac:~ woz$ ln -s /usr/local/Cellar/boost/1.57.0 boost_1_57_0mac:~ woz$ 

Inside Xcode refer to the just created symlink like this

Xcode build settings for boost

For the Header Search Paths use $(HOME)/boost_1_57_0/include

For the Library Search Paths use $(HOME)/boost_1_57_0/lib


I'm using boost with Xcode 3.2.1 on mac os 10.6.8

I had problems with using boost and Xcode today, finally I managed to make it work so I hope this helps:

  1. download boost, I got the 1.52.0 today, untar it

  2. install boost:

    at first I couldn't do the ./bootstrap.sh, it stopped after the first few lines. After some googling, I got the answer, it was because when I installed Xcode a long time ago, for some reason I didn't check the “Unix development" in the install options. At this point, reinstall a newer version of Xcode and check the "unix development line"

    after that, the ./bootstrap and ./b2 install worked fine

  3. the lambda example:

    at this point, the first example should work fine, if it doesn't try adding /usr/local/include in the project settings/header search path

  4. using thread or something else that requires to be built

    threads require a specific dylib to work: libboost_system.dylib. on my system it was located in /usr/local/lib after the ./b2 install thingy

    in the left part of the GUI, you can right click anywhere and select Add Existing File

    if the file is hidden you can find a shortcut to get to usr/local/lib in the directory /Developer/SDKs/MacOSX10.6.sdk/usr/local

once the libboost_system.dylib does appear in the Groups and Files part of the GUI, it should work