How do you install Boost on MacOS? Right now I can't find bjam for the Mac.
-
1You can always try like "port search
" - in your case boost - when unsure. – gustafbstrom Nov 17 '13 at 09:17 -
I've used both macports and brew. I use them together when necessary (`sudo port -t install X`) but I prefer brew over macports in most cases. – Jacksonkr Apr 15 '16 at 14:13
-
1For newer M1 : `arch -arm64 brew install boost` works – Pe Dro Apr 26 '22 at 05:55
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. – Luke Stanley Jun 20 '13 at 13:37
-
7@LukeStanley AFAIK Homebrew uses pre-compiled packages ("bottles") for Boost these days, making the installation a matter of seconds. – Philipp Jul 29 '13 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. – user1255933 May 28 '14 at 01:51
-
I'm using a late 2013 MBP with i7 8gb ram. The fan was running fast when the compilation was going on. It finished just before "it's too long". – LShi Sep 19 '15 at 02:48
-
Would be cautious of the version of boost library getting picked up by brew though. I think by default when i last installed using brew was 1.6. That didnt work for me as the others had dependency with 1.57. So, i forced brew to pick that version while installing – Pramit Feb 08 '16 at 22:13
-
I can't find a boost.framework file anywhere after doing a brew install, anyone know where to look? – TheJeff Feb 10 '16 at 22:06
-
9
-
-
-
3Hi, nice answer! What if I want to install boost@1.58? There is no 1.58 available with homebrew? – GoingMyWay Sep 13 '17 at 15:18
-
1
-
As for 2021-10-23, it installs 1.76.0 (Boost.log is included); total time <1 min – cbuchart Oct 23 '21 at 07:12
-
@LukeStanley Less than a minute for me. M1 Macbook Pro though. – Terry Windwalker Aug 09 '22 at 04:57
Download MacPorts, and run the following command:
sudo port install boost

- 8,430
- 4
- 49
- 64

- 1,694
- 1
- 11
- 2
-
2if you prefer running things through root `sudo -s /opt/local/bin/port install boost` – Pungs Feb 12 '13 at 16:21
-
2I don't believe macports is dead inasmuch as it has fallen out of fashion. – Josef Salyer Nov 23 '13 at 03:39
-
3
-
4
-
1Because the asker presumably uses, or at least used to use, MacPorts. – saagarjha Feb 29 '20 at 14:44
-
I don't think its wise to use both home-brew and Mac ports -- so it is convenient so that there is an answer for both. – wcochran Nov 29 '20 at 22:39
-
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. – Wedge Martin May 27 '14 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. – wdavilaneto Jan 05 '15 at 05: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. – snies Oct 23 '15 at 08:20
Install both of them using homebrew separately.
brew install boost
brew install bjam

- 151
- 1
- 6
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.

- 3,899
- 22
- 30
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.

- 98,632
- 24
- 142
- 234
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

- 51
- 1
- 4
In order to avoid troubles compiling third party libraries that need boost installed in your system, run this:
sudo port install boost +universal

- 704
- 8
- 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
-
No hint what is bjam and why you think your answer fixes boost related issue. – Tõnu Samuel Sep 15 '19 at 04:18