This document describes how to install the Apache Thrift compiler on macOS using Homebrew or build it from source.
The easiest and recommended way to install the Apache Thrift compiler on macOS is using Homebrew:
brew install thrift
Verify the installation:
thrift -version
To build the Apache Thrift compiler from source, install the build tools using Homebrew:
brew install automake libtool pkg-config cmake bison flex
Note: The default
bisonbinary shipped with macOS is outdated (v2.3) and incompatible with Thrift’s grammar files. Homebrew installs a newer version as keg-only, so ensure it is available in yourPATHor passed explicitly.
The recipes below build only the compiler. To build the C++ library as well, add boost libevent openssl to the brew install line. With CMake, replace -DBUILD_LIBRARIES=OFF with -DWITH_JAVASCRIPT=OFF -DWITH_NODEJS=OFF -DWITH_JAVA=OFF -DWITH_PYTHON=OFF: every library whose tools CMake finds is built by default, and the JavaScript and Node.js ones run npm install without checking for Node.js first. With Autotools, drop --disable-libs and pass --without-<lang> for each other language whose tools are installed; ./configure --help lists them.
cmake -B cmake-build \
-DBISON_EXECUTABLE="$(brew --prefix bison)/bin/bison" \
-DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_TUTORIALS=OFF
cmake --build cmake-build
sudo cmake --install cmake-build
export PATH="$(brew --prefix bison)/bin:$PATH"
./bootstrap.sh
./configure --disable-libs --disable-tests
make
sudo make install
If you prefer not to use Homebrew, you can build the dependencies manually:
Download the Boost library from boost.org, extract and compile with:
./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install
Download libevent, extract and compile with:
./configure --prefix=/usr/local
make
sudo make install
Download the latest release of Apache Thrift, extract and compile with:
./configure --prefix=/usr/local --with-boost=/usr/local --with-libevent=/usr/local
make
sudo make install
For more information on the requirements see: Apache Thrift Requirements
For more information on building and installing Thrift see: Building from source