Setup on macOS

Building Garvan applications on macOS works the same way as on Linux — the bundled libgarvan.a is universal, you only need to install a few system libraries.

Requirements

  • Xcode command line tools (xcode-select --install).
  • A C++ compiler with C++20 support (the Apple Clang shipped with Xcode 14+ works).
  • CMake 3.20 or later.
  • Asio headers.

Using Homebrew

The easiest path is via Homebrew. Install the build tools and any database drivers you need:

brew install cmake asio openssl@3
brew install libpq mysql-connector-c++ mongo-cxx-driver sqlite

Compiling your project

Point CMake at the Homebrew prefixes for OpenSSL:

cmake -S . -B build \
    -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \
    -DCMAKE_PREFIX_PATH=$(brew --prefix)
cmake --build build
Tip

On Apple Silicon Macs, make sure all your dependencies are arm64 builds — mixing x86_64 Homebrew with arm64 will fail at link time.