How do you install Boost on MacOS?

2019-01-07 04:34发布

问题:

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

回答1:

Download MacPorts, and run the following command:

sudo port install boost 


回答2:

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

brew install boost.

http://brewformulas.org/Boost



回答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.



回答4:

Fink 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.



回答5:

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.



回答6:

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

sudo port install boost +universal


回答7:

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


回答8:

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



回答9:

Install both of them using homebrew separately.

brew install boost
brew install bjam



标签: c++ macos boost