ClickHouse/docs/en/development/build-osx.md

135 lines
3.5 KiB
Markdown
Raw Normal View History

2020-04-03 13:23:32 +00:00
---
toc_priority: 65
2020-07-20 14:29:13 +00:00
toc_title: Build on Mac OS X
2020-04-03 13:23:32 +00:00
---
2020-03-20 10:10:48 +00:00
# How to Build ClickHouse on Mac OS X {#how-to-build-clickhouse-on-mac-os-x}
2021-04-08 14:26:51 +00:00
Build should work on x86_64 (Intel) and arm64 (Apple Silicon) based macOS 10.15 (Catalina) and higher with recent Xcode's native AppleClang, or Homebrew's vanilla Clang or GCC compilers.
2020-03-20 10:10:48 +00:00
## Install Homebrew {#install-homebrew}
2020-03-20 10:10:48 +00:00
``` bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# ...and follow the printed instructions on any additional steps required to complete the installation.
```
2021-04-02 13:31:20 +00:00
## Install Xcode and Command Line Tools {#install-xcode-and-command-line-tools}
2021-04-02 18:09:12 +00:00
Install the latest [Xcode](https://apps.apple.com/am/app/xcode/id497799835?mt=12) from App Store.
2021-04-02 13:31:20 +00:00
Open it at least once to accept the end-user license agreement and automatically install the required components.
2021-05-27 19:48:20 +00:00
Then, make sure that the latest Command Line Tools are installed and selected in the system:
2021-04-02 13:31:20 +00:00
``` bash
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
2021-04-02 13:31:20 +00:00
```
Reboot.
2020-03-20 10:10:48 +00:00
## Install Required Compilers, Tools, and Libraries {#install-required-compilers-tools-and-libraries}
2020-03-20 10:10:48 +00:00
``` bash
brew update
brew install cmake ninja libtool gettext llvm gcc binutils
```
2020-03-20 10:10:48 +00:00
## Checkout ClickHouse Sources {#checkout-clickhouse-sources}
2020-03-20 10:10:48 +00:00
``` bash
git clone --recursive git@github.com:ClickHouse/ClickHouse.git
# ...alternatively, you can use https://github.com/ClickHouse/ClickHouse.git as the repo URL.
DOCAPI-8530: Code blocks markup fix (#7060) * Typo fix. * Links fix. * Fixed links in docs. * More fixes. * docs/en: cleaning some files * docs/en: cleaning data_types * docs/en: cleaning database_engines * docs/en: cleaning development * docs/en: cleaning getting_started * docs/en: cleaning interfaces * docs/en: cleaning operations * docs/en: cleaning query_lamguage * docs/en: cleaning en * docs/ru: cleaning data_types * docs/ru: cleaning index * docs/ru: cleaning database_engines * docs/ru: cleaning development * docs/ru: cleaning general * docs/ru: cleaning getting_started * docs/ru: cleaning interfaces * docs/ru: cleaning operations * docs/ru: cleaning query_language * docs: cleaning interfaces/http * Update docs/en/data_types/array.md decorated ``` Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/getting_started/example_datasets/nyc_taxi.md fixed typo Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/getting_started/example_datasets/ontime.md fixed typo Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/interfaces/formats.md fixed error Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/operations/table_engines/custom_partitioning_key.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/operations/utils/clickhouse-local.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/dicts/external_dicts_dict_sources.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/operations/utils/clickhouse-local.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/functions/json_functions.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/functions/json_functions.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/functions/other_functions.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/functions/other_functions.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/query_language/functions/date_time_functions.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/operations/table_engines/jdbc.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * docs: fixed error * docs: fixed error
2019-09-23 15:31:46 +00:00
```
2020-03-20 10:10:48 +00:00
2021-04-02 13:31:20 +00:00
## Build ClickHouse {#build-clickhouse}
To build using Xcode's native AppleClang compiler:
2020-03-20 10:10:48 +00:00
``` bash
cd ClickHouse
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . --config RelWithDebInfo
cd ..
```
2021-04-02 13:31:20 +00:00
To build using Homebrew's vanilla Clang compiler:
2021-04-02 13:31:20 +00:00
``` bash
cd ClickHouse
rm -rf build
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . --config RelWithDebInfo
cd ..
2021-04-02 13:31:20 +00:00
```
To build using Homebrew's vanilla GCC compiler:
2020-12-13 08:10:07 +00:00
2020-03-20 10:10:48 +00:00
``` bash
cd ClickHouse
rm -rf build
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=$(brew --prefix gcc)/bin/gcc-10 -DCMAKE_CXX_COMPILER=$(brew --prefix gcc)/bin/g++-10 -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . --config RelWithDebInfo
cd ..
```
2020-03-20 10:10:48 +00:00
## Caveats {#caveats}
2020-07-20 14:29:13 +00:00
If you intend to run `clickhouse-server`, make sure to increase the systems maxfiles variable.
WIP on documentation (#2692) * Additional .gitignore entries * Merge a bunch of small articles about system tables into single one * Merge a bunch of small articles about formats into single one * Adapt table with formats to English docs too * Add SPb meetup link to main page * Move Utilities out of top level of docs (the location is probably not yet final) + translate couple articles * Merge MacOS.md into build_osx.md * Move Data types higher in ToC * Publish changelog on website alongside documentation * Few fixes for en/table_engines/file.md * Use smaller header sizes in changelogs * Group up table engines inside ToC * Move table engines out of top level too * Specificy in ToC that query language is SQL based. Thats a bit excessive, but catches eye. * Move stuff that is part of query language into respective folder * Move table functions lower in ToC * Lost redirects.txt update * Do not rely on comments in yaml + fix few ru titles * Extract major parts of queries.md into separate articles * queries.md has been supposed to be removed * Fix weird translation * Fix a bunch of links * There is only table of contents left * "Query language" is actually part of SQL abbreviation * Change filename in README.md too * fix mistype * s/formats\/interfaces/interfaces\/formats/g * Remove extra clarification from header as it was too verbose, probably making it a bit more confusing * Empty article was supposed to be hidden * At least change incorrect title * Move special links to the bottom of nav and slightly highlight them * Skip hidden pages in bottom navigation too * Make front page of documentation to be part of Introduction * Make tables in introduction somewhat readable + move abbreviation definitions earlier * Some introduction text refactoring * Some docs introduction refactoring * Use admonitions instead of divs * Additional .gitignore * Treat .gif as images too * Clarify ToC item
2018-07-20 17:35:34 +00:00
!!! info "Note"
2020-03-20 10:10:48 +00:00
Youll need to use sudo.
2020-07-20 14:29:13 +00:00
To do so, create the `/Library/LaunchDaemons/limit.maxfiles.plist` file with the following content:
2020-03-20 10:10:48 +00:00
``` xml
<?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>
```
Execute the following command:
2020-03-20 10:10:48 +00:00
``` bash
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
```
Reboot.
2020-03-20 10:10:48 +00:00
To check if its working, you can use `ulimit -n` command.
## Run ClickHouse server:
```
2021-05-05 14:56:20 +00:00
cd ClickHouse
./build/programs/clickhouse-server --config-file ./programs/server/config.xml
```
2020-01-30 10:34:55 +00:00
[Original article](https://clickhouse.tech/docs/en/development/build_osx/) <!--hide-->