How do you install Boost on MacOS?

How do you install Boost on MacOS? Right now I can't find bjam for the Mac.


Solution 1:

You can get the latest version of Boost by using Homebrew.

brew install boost.

Solution 2:

Download MacPorts, and run the following command:

sudo port install boost 

Solution 3:

Just get the source, and compile Boost yourself; it has become very easy. Here is an example for the current version of Boost on the current macOS as of this writing:

  1. Download the the .tar.gz from https://www.boost.org/users/download/#live
  2. Unpack and go into the directory:

    tar -xzf boost_1_50_0.tar.gz
    cd boost_1_50_0
  3. Configure (and build bjam):

    ./bootstrap.sh --prefix=/some/dir/you/would/like/to/prefix
  4. Build:

    ./b2
  5. Install:

    ./b2 install

Depending on the prefix you choose in Step 3, you might need to sudo Step 5, if the script tries copy files to a protected location.