Building FoundationDB on macOS with Homebrew

In case you need to build FoundationDB on macOS without the upstream-provided Docker build container, here’s how to do it!

Note: These instructions assume that you have Homebrew installed under the default /usr/local path. Make sure to update the paths below if you’ve installed somewhere else.

# Install dependencies.
$ brew update && brew install python mono ninja boost openssl@1.1

# fdbuild will hold all of the ninja/cmake intermediate artifacts.
$ mkdir fdbuild && cd fdbuild

# Tip: You may want to checkout a release branch.
$ git clone git@github.com:apple/foundationdb.git

# This will generate the ninja/cmake configs your build.
# Tip: Make sure to check for errors/warnings!
$ Boost_INCLUDE_DIR=/usr/local/Cellar/boost/1.72.0_3/include \
  OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1 \
  cmake \
    -DPython3_EXECUTABLE=/usr/local/Cellar/python/3.7.7/bin/python3.7 \
    -G Ninja \
    foundationdb/
# Build!
$ ninja

As per the Compiling from Source section of the FoundationDB README, this build is memory hungry! You may need to “ninja -j1” to reduce the overhead, at the expense of compile time.