2020-03-20 18:20:59 +00:00
|
|
|
|
# 在 Mac OS X 中编译 ClickHouse {#zai-mac-os-x-zhong-bian-yi-clickhouse}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
|
|
|
|
ClickHouse 支持在 Mac OS X 10.12 版本中编译。若您在用更早的操作系统版本,可以尝试在指令中使用 `Gentoo Prefix` 和 `clang sl`.
|
|
|
|
|
通过适当的更改,它应该可以适用于任何其他的 Linux 发行版。
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
## 安装 Homebrew {#an-zhuang-homebrew}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
|
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
|
|
|
```
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
## 安装编译器,工具库 {#an-zhuang-bian-yi-qi-gong-ju-ku}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
``` bash
|
2020-01-18 15:44:08 +00:00
|
|
|
|
brew install cmake ninja gcc icu4c mariadb-connector-c openssl libtool gettext
|
2018-12-10 09:19:32 +00:00
|
|
|
|
```
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
## 拉取 ClickHouse 源码 {#la-qu-clickhouse-yuan-ma}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
``` bash
|
2020-03-11 07:26:18 +00:00
|
|
|
|
git clone --recursive git@github.com:ClickHouse/ClickHouse.git
|
|
|
|
|
# or: git clone --recursive https://github.com/ClickHouse/ClickHouse.git
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
|
|
|
|
cd ClickHouse
|
|
|
|
|
```
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
## 编译 ClickHouse {#bian-yi-clickhouse}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
``` bash
|
2018-12-10 09:19:32 +00:00
|
|
|
|
mkdir build
|
|
|
|
|
cd build
|
|
|
|
|
cmake .. -DCMAKE_CXX_COMPILER=`which g++-8` -DCMAKE_C_COMPILER=`which gcc-8`
|
|
|
|
|
ninja
|
|
|
|
|
cd ..
|
|
|
|
|
```
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
## 注意事项 {#zhu-yi-shi-xiang}
|
2018-12-10 09:19:32 +00:00
|
|
|
|
|
|
|
|
|
若你想运行 clickhouse-server,请先确保增加系统的最大文件数配置。
|
|
|
|
|
|
2020-03-20 18:20:59 +00:00
|
|
|
|
!!! 注意 "注意"
|
2018-12-10 09:19:32 +00:00
|
|
|
|
可能需要用 sudo
|
|
|
|
|
|
|
|
|
|
为此,请创建以下文件:
|
|
|
|
|
|
2020-04-08 14:22:25 +00:00
|
|
|
|
/图书馆/LaunchDaemons/限制.maxfilesplist:
|
2020-03-20 18:20:59 +00:00
|
|
|
|
|
2018-12-10 09:19:32 +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>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
执行以下命令:
|
2020-03-20 18:20:59 +00:00
|
|
|
|
|
2018-12-10 09:19:32 +00:00
|
|
|
|
``` bash
|
|
|
|
|
$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
然后重启。
|
|
|
|
|
|
|
|
|
|
可以通过 `ulimit -n` 命令来检查是否生效。
|
|
|
|
|
|
2020-01-30 10:34:55 +00:00
|
|
|
|
[来源文章](https://clickhouse.tech/docs/en/development/build_osx/) <!--hide-->
|