Installing OpenFHE on MacOS

These instructions were tested in macOS Mojave but should also work for other recent releases. It is assumed that the clang compiler that comes with Xcode is used for building OpenFHE.

  1. Install the Mac terminal command line functions if needed (type git at the command line to trigger the install). Then install home-brew if not already present:

/bin/bash -c "$(curl -fsSL"
  1. Install pre-requisites cmake and OpenMP library using Homebrew:

brew install cmake
brew install libomp
  1. Clone the repo.

  2. Create a directory where the binaries will be built. The typical choice is a subfolder build.

mkdir build
cd build

Cmake will check for any system dependencies that are needed for the build process. Note there are issues with some versions of clang/OMP and regular expressions that may cause cmake to fail. The general fix is to run cmake twice. There are two distinct cases.

cmake ..


If you get an error about a missing regular expression backend, run the following commands

cmake ..

If you get an error about OMP asking to rerun cmake, just run “cmake ..” once more.

  1. The OpenFHE distribution includes some external libraries, such as GMP, NTL and tcmalloc. If you want to use any of these libraries:
    1. install autoconf using Homebrew:

    brew install autoconf
    1. enable them when you run cmake to force them to build (see instructions on cmake options)

  2. Build OpenFHE by running the following command (this will take few minutes; using the -j # make command-line flag is suggested to speed up the build, where # is the number of cores on your machine).

  1. Install OpenFHE in a system directory (if desired or for production purposes)

make install

You would probably need to run sudo make install unless you are specifying some other install location. You can change the install location by running cmake -DCMAKE_INSTALL_PREFIX=/your/path ..

Testing and cleaning the build

Run unit tests to make sure all capabilities operate as expected

make testall

Run sample code to test, e.g.,


To remove the files built by make, you can execute

make clean