Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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.
- x86_64
- AArch64
- PowerPC 64 LE (experimental)
- s390/x (experimental)
- RISC-V 64 (experimental)
Assumptions
The following tutorial is based on Ubuntu Linux but it should also work on any other Linux distribution with appropriate changes. The minimum recommended Ubuntu version for development is 24.04 LTS. The tutorial assumes that you have the ClickHouse repository and all submodules locally checked out.Install prerequisites
First, see the generic prerequisites documentation. ClickHouse uses CMake and Ninja for building. You can optionally install ccache to let the build reuse already compiled object files.Install the Clang compiler
To install Clang on Ubuntu/Debian, use LLVM’s automatic installation script from here.Install the Rust compiler (optional)
Rust is an optional dependency of ClickHouse.
If Rust is not installed, some features of ClickHouse will be omitted from compilation.
rustup.
As with C++ dependencies, ClickHouse uses vendoring to control exactly what’s installed and avoid depending on third party services (like the crates.io registry).
Although in release mode any rust modern rustup toolchain version should work with these dependencies, if you plan to enable sanitizers you must use a version that matches the exact same std as the one used in CI (for which we vendor the crates):
Build ClickHouse
We recommend to create a separate directorybuild inside ClickHouse which contains all build artifacts:
build_release, build_debug, etc.) for different build types.
Optional: If you have multiple compiler versions installed, you can optionally specify the exact compiler to use.
-O) which provides a better debugging experience.
Also, internal exceptions of type LOGICAL_ERROR crash immediately instead of failing gracefully.
If you wish to use a debugger such as gdb, add
-D DEBUG_O_LEVEL="0" to the above command to remove all compiler optimizations, which can interfere with gdb’s ability to view/access variables.-j:
clickhouse-server, clickhouse-client, and similar binaries are symbolic links in the programs/ directory that point to the clickhouse executable after the build is completed.:::tip
CMake provides shortcuts for above commands:Running the ClickHouse Executable
After the build completed successfully, you find the executable inClickHouse/<build_dir>/programs/:
The ClickHouse server tries to find a configuration file config.xml in the current directory.
You can alternative specify a configuration file on the command-line via -C.
To connect to the ClickHouse server with clickhouse-client, open another terminal, navigate to ClickHouse/build/programs/ and run ./clickhouse client.
If you get Connection refused message on macOS or FreeBSD, try specifying host address 127.0.0.1:
Advanced options
Minimal Build
If you don’t need functionality provided by third-party libraries, you can speed the build further up:Running the ClickHouse Executable
You can replace the production version of ClickHouse binary installed in your system with the compiled ClickHouse binary. To do that, install ClickHouse on your machine following the instructions from the official website. Next, run:clickhouse-client, clickhouse-server and others are symlinks to the commonly shared clickhouse binary.
You can also run your custom-built ClickHouse binary with the config file from the ClickHouse package installed on your system:
Building on Any Linux
Install prerequisites on OpenSUSE Tumbleweed:Building in docker
You can run any build locally in an environment similar to CI using:clickhouse/binary-builder with all required dependencies,
and runs the build script inside it: ./ci/jobs/build_clickhouse.py
The build output will be placed in ./ci/tmp/.
It works on both AMD and ARM architectures and requires no additional dependencies other than Python with requests module available and Docker.