Skip to main content
Skip to main content
Edit this page

How to Build ClickHouse on macOS for macOS

You don't need to build ClickHouse yourself!

You can install pre-built ClickHouse as described in Quick Start.

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.

Building with Apple's XCode apple-clang is not recommended, it may break in arbitrary ways.

Install Prerequisites

First install Homebrew.

Next, run:

For Apple XCode Clang (discouraged), install the latest XCode the from App Store. Open it at least once to accept the end-user license agreement and automatically install the required components. Then, make sure that the latest Command Line Tools are installed and selected in the system:

Note

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 using Homebrew's Clang compiler:

To build using XCode native AppleClang compiler in XCode IDE (not recommended):

Caveats

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

Note

You'll need to use sudo.

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

Give the file correct permissions:

Validate that the file is correct:

Load the file (or reboot):

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