Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Build on macOS for macOS

ClickHouse can be compiled on macOS x86_64 (Intel) and arm64 (Apple Silicon) using on macOS 10.15 (Catalina) or higher.

As compiler, only Clang from homebrew is supported.

Install prerequisites

First, see the generic prerequisites documentation.

Next, install Homebrew and run

Then run:

brew update
brew install ccache cmake ninja libtool gettext llvm lld binutils grep findutils nasm bash rust rustup

Build ClickHouse

To build you must use Homebrew’s Clang compiler:

cd ClickHouse
mkdir build
export PATH=$(brew --prefix llvm)/bin:$PATH
cmake -S . -B build
cmake --build build
# The resulting binary will be created at: build/programs/clickhouse

Caveats

If you intend to run clickhouse-server, make sure to increase the system’s maxfiles variable.

To do so, create the /Library/LaunchDaemons/limit.maxfiles.plist file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>524288</string>
      <string>524288</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
  </dict>
</plist>

Give the file correct permissions:

sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist

Validate that the file is correct:

plutil /Library/LaunchDaemons/limit.maxfiles.plist

Load the file (or reboot):

sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist

To check if it’s working, use the ulimit -n or launchctl limit maxfiles commands.

Navigation