This build guide is for contributors modifying ClickHouse itself.If you are not changing ClickHouse source code, you can install pre-built ClickHouse as described in Quick Start.
Install prerequisites
First, see the generic prerequisites documentation. Next, install Homebrew and run Then run:Like ClickHouse also pins the Rust toolchain used by the
llvm, Homebrew’s rustup is keg-only, so its bin directory is not added to PATH automatically. Export it the same way llvm’s PATH is exported in Build ClickHouse:corrosion contrib module. Install and select it by following the Install the Rust compiler section of the Linux build guide. Without this, cmake fails at the corrosion contrib module with Cannot find nightly-<date> Rust toolchain.Apple uses a case-insensitive file system by default. While this usually does not affect compilation (especially scratch makes will work), it can confuse file operations like
git mv.
For serious development on macOS, make sure that the source code is stored on a case-sensitive disk volume, e.g. see these instructions.Build ClickHouse
To build you must use Homebrew’s Clang compiler:Plain
brew install llvm always installs Homebrew’s latest LLVM release, which can be newer than the Clang version pinned for CI and Linux builds (see Install the Clang compiler). A newer Clang can enable -Weverything diagnostics that aren’t yet suppressed in the build and fail under -Werror. If that happens, install the pinned major version instead, e.g. via a versioned formula (brew install llvm@<version>) if Homebrew still carries it, rather than disabling warnings.If you are running into
ld: archive member '/' not a mach-o file in ... errors during linking, you may need
to use llvm-ar by setting flag -DCMAKE_AR=/opt/homebrew/opt/llvm/bin/llvm-ar.Caveats
If you intend to runclickhouse-server, make sure to increase the system’s maxfiles variable.
You’ll need to use sudo.
/Library/LaunchDaemons/limit.maxfiles.plist file with the following content:
ulimit -n or launchctl limit maxfiles commands.