Building and installing MongoDB C++ driver in OS X Building and installing MongoDB C++ driver in OS X mongodb mongodb

Building and installing MongoDB C++ driver in OS X


It took me a while to get this working.Hopefully you can get yours working from the following steps:

Create a new C++ project in Xcode

I copied the code from <mongo_driver_install>/src/mongo/client/examples/tutorial.cpp as a test

In Build Settings/Search Paths:

screen shot of search paths

Add the following to your Header Search Paths:

/path/to/mongo-cxx-driver-nightly/src

and your equivalent path for the boost library header files (the folder should contain a boost folder):

/usr/local/Cellar/boost/1.54.0/include

Add the following to your Library Search Paths:

/usr/local/lib (in my case holds all of the boost libraries)/path/to/mongo-cxx-driver-nightly

Link Binaries

In the Build Phases/Link Binary with Libraries settings:

Screen shot of build phases

Add the following binaries:

/path/to/mongo-cxx-driver-nightly/libmongoclient.a/usr/local/lib/libboost_thread-mt.dylib/usr/local/lib/libboost_system-mt.dylib/usr/local/lib/libboost_filesystem-mt.dylib/usr/local/lib/libboost_program_options-mt.dylib