Build for OS X

To set up your OS X computer for MongoDB development:



Available in the App Store. You only need to get the command line tools, if you don’t want to install the whole IDE.


SCons is the build tool used to compile mongo binaries. It is available from http://www.scons.org.

If you have easy_install or pip already installed, you can use them to install scons:

easy_install scons
pip install scons


An installer package is available from http://git-scm.com/.


  1. Install any needed prerequisites (see above).

  2. Get the source code

    git clone git://github.com/mongodb/mongo.git
    cd mongo
  3. Pick a version to build (only use “master” if you’re doing development work).

    1. List all tagged versions

      git tag -l
    2. Check out a tagged release

      git checkout r2.4.0
  4. Compile

    scons all
  5. Install. Use --prefix to specify where you want to install your binaries. Defaults to /usr/local.

    scons --prefix=/opt/mongo install


  • Undefined symbols: “_PR_NewLock”, referenced from: _JS_Init in libjs.a.

    If you are using the scons --release option, run without that option. That option attempts to use static libraries.