1.安装homebrew
2.更新XCode
sudo xcode-select --install
3.安装依赖
brew update
brew install cmake ninja libtool gettext llvm gcc binutils
4.下载ClickHouse源码(下载超慢。。。)
git clone --recursive https://github.com/ClickHouse/ClickHouse.git
5.编译ClickHouse源码
cd ClickHouse
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . --config RelWithDebInfo
cd ..
6.添加系统的最大文件配置
vim /Library/LaunchDaemons/limit.maxfiles.plist
#添加以下内容
<?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>
# 然后执行以下命令
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
# 然后重启,通过 ulimit -n看是否生效
ulimit -n
编译源码时候报错了,没解决。。。M1好难整。