How do you install Boost on MacOS? Right now I can't find bjam for the Mac.
11 Answers
You can get the latest version of Boost by using Homebrew.
brew install boost
.
-
8How long does it take different people? Took me 48 mins with 2 GB RAM, not sure what CPU. Jun 20, 2013 at 13:37
-
7@LukeStanley AFAIK Homebrew uses pre-compiled packages ("bottles") for Boost these days, making the installation a matter of seconds.– PhilippJul 29, 2013 at 12:35
-
8Matter of seconds? I'm on Mountain Lion, 2.9GHz processor, 8GB of RAM and installation is still not complete after 15min. May 28, 2014 at 1:51
-
10
-
3Hi, nice answer! What if I want to install [email protected]? There is no 1.58 available with homebrew? Sep 13, 2017 at 15:18
Download MacPorts, and run the following command:
sudo port install boost
-
2if you prefer running things through root
sudo -s /opt/local/bin/port install boost
– PungsFeb 12, 2013 at 16:21 -
2I don't believe macports is dead inasmuch as it has fallen out of fashion. Nov 23, 2013 at 3:39
-
3
-
4How is this accepted over the Homebrew answer? That makes no sense to me...– user6516765Oct 9, 2018 at 15:40
-
1Because the asker presumably uses, or at least used to use, MacPorts. Feb 29, 2020 at 14:44
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:
- Download the the .tar.gz from https://www.boost.org/users/download/#live
Unpack and go into the directory:
tar -xzf boost_1_50_0.tar.gz cd boost_1_50_0
Configure (and build
bjam
):./bootstrap.sh --prefix=/some/dir/you/would/like/to/prefix
Build:
./b2
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.
-
4Best route if you need to link against boost_thread. The standard brew recipes don't seem to include it. May 27, 2014 at 14:52
-
If you want to install other executables that depends on boost at default runtime environment ok, use other answers, in any other case, use this answer. Best for you to know when you ara compiling with boost and how. You will have it as as it is supposed to be. And Most important, It will force you to think where boost will be on Continuous Integration (Build) server, and if has an deployment server too. Jan 5, 2015 at 5:16
-
1
-
1@MAS (I did not try it today. But the bootstrap.sh should come with the tar.gz file. It configures the build process and creates the bjam build tool. The "prefix" is a common option for build tools which will be prefixed to the install path. This means, that if a file would be installed in /bin it will instead be installed in /prefix/bin when the install command is issued. You can use that to avoid permission problems. For example i install optional packages i use for development in /home/snies/opt/bin instead of /bin so i don't need root permissions and don't mess up my system.– sniesOct 23, 2015 at 8:20
Install both of them using homebrew separately.
brew install boost
brew install bjam
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.
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.
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
In order to avoid troubles compiling third party libraries that need boost installed in your system, run this:
sudo port install boost +universal
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
-
-
But port seems promising... And actually they decided that it's not worth the effort or they cannot maintain it: github.com/Homebrew/brew/issues/10307 what a blow to brew– IceFireOct 31 at 18:56
-
you can download bjam for OSX (or any other OS) here
-
No hint what is bjam and why you think your answer fixes boost related issue. Sep 15, 2019 at 4:18
sudo port -t install X
) but I prefer brew over macports in most cases.arch -arm64 brew install boost
works