Skip to content

Set up Build Environment on macOS

Janek Bevendorff edited this page Nov 21, 2023 · 26 revisions

Note: This is only a one-time setup guide. For actually building KeePassXC, please refer to our build guide.

Install the build toolchain

First, install Xcode from the AppStore and run

xcode-select --install

in a terminal to install the Xcode CLI tools. Next, install Homebrew and use it to install the remaining build tools:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install cmake asciidoctor

Install build dependencies

To install the actual build dependencies, there are two options:

  1. Via Homebrew (faster, but suitable only for local builds).
  2. Via vcpkg (much slower, but suitable for distribution).

Option 1: Install build dependencies via Homebrew

Open a terminal and run:

brew install qt@5 argon2 botan qrencode readline minizip

Option 2: Install build dependencies via vcpkg

Set up vcpkg in a location of your choosing:

git clone https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh

Install pkg-config and (optionally) the vcpkg stub package via Homebrew:

brew install pkg-config vcpkg

If you installed the vcpkg stub package, set the ``VCPKG_ROOTenvironment variable to your install location. You can then run thevcpkg` from anywhere, given that Homebrew is in your `PATH`. Otherwise, call the `vcpkg` binary with its full path.

Finally, compile and install the actual build dependencies:

vcpkg install argon2 botan minizip qt5 qt5-svg qt5-tools qt5-imageformats \
    qt5-translations readline zlib libqrencode

Update your environment regularly

Homebrew:

brew update && brew upgrade

vcpkg:

cd vcpkg && git pull && ./vcpkg update