How do you install Boost on MacOS?

C++MacosBoost

C++ Problem Overview


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

C++ Solutions


Solution 1 - C++

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

brew install boost.

Solution 2 - C++

Download MacPorts, and run the following command:

sudo port install boost 

Solution 3 - C++

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.

Solution 4 - C++

Unless your compiler is different than the one supplied with the Mac XCode Dev tools, just follow the instructions in section 5.1 of Getting Started Guide for Unix Variants. The configuration and building of the latest source couldn't be easier, and it took all about about 1 minute to configure and 10 minutes to compile.

Solution 5 - C++

http://www.finkproject.org/">Fink</a> appears to have a full set of Boost packages...

With fink installed and running just do

fink install boost1.35.nopython

at the terminal and accept the dependencies it insists on. Or use

fink list boost

to get a list of different packages that are availible.

Solution 6 - C++

Install both of them using homebrew separately.

> brew install boost
> brew install bjam

Solution 7 - C++

Install Xcode from the mac app store. Then use the command:

  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

the above will install homebrew and allow you to use brew in terminal

then just use command :

brew install boost

which would then install the boost libraries to <your macusername>/usr/local/Cellar/boost

Solution 8 - C++

In order to avoid troubles compiling third party libraries that need boost installed in your system, run this:

sudo port install boost +universal

Solution 9 - C++

Try +universal

One thing to note: in order for that to make a difference you need to have built python with +universal, if you haven't or you're not sure you can just rebuild python +universal. This applies to both brew as well as macports.

$ brew reinstall python
$ brew install boost

OR

$ sudo port -f uninstall python
$ sudo port install python +universal
$ sudo port install boost +universal

Solution 10 - C++

you can download bjam for OSX (or any other OS) here

Solution 11 - C++

If you are too lazy like me: conda install -c conda-forge boost

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobert GouldView Question on Stackoverflow
Solution 1 - C++jrwrenView Answer on Stackoverflow
Solution 2 - C++diesView Answer on Stackoverflow
Solution 3 - C++sniesView Answer on Stackoverflow
Solution 4 - C++Paul KohutView Answer on Stackoverflow
Solution 5 - C++dmckee --- ex-moderator kittenView Answer on Stackoverflow
Solution 6 - C++Kondal RaoView Answer on Stackoverflow
Solution 7 - C++UDAY JAINView Answer on Stackoverflow
Solution 8 - C++user1823890View Answer on Stackoverflow
Solution 9 - C++JacksonkrView Answer on Stackoverflow
Solution 10 - C++FerruccioView Answer on Stackoverflow
Solution 11 - C++Neo liView Answer on Stackoverflow