Provide a simple way to build Watchman from source on macOS.
-
Install
Xcode/Command Line Tools(fromxcode-select --install) -
Setup environment variables:
export PATH="/Library/Developer/CommandLineTools/usr/bin:${PATH}"
export CC=clang
export CXX=clang++
export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk# Use the stable release
git clone --depth=1 -b v2022_05_16 https://github.com/thachnn/watchman-builder.git
cd watchman-builder
./build.sh --prefix=/opt/local --scratch-path=/usr/local/src \
--without-python --state-dir=/usr/local/var/run/watchman --with-os-libs
# Pack the built
cd /opt/local && zip -r ~/watchman-2022.05.16-macos.zip bin/watchman*
cd /usr/local && zip -ru ~/watchman-2022.05.16-macos.zip var/run/watchman*- To run Folly/Watchman unit-tests, just build with
--unit-testoption
./build.sh --prefix=/opt/local --scratch-path=/usr/local/src \
--without-python --state-dir=/usr/local/var/run/watchman --with-os-libs --unit-test- To optimize
watchmanctl, just install the optimizedRustcompiler first, then use it for building
# sudo chmod g+w /usr/local/{bin,lib,libexec,include,etc,share,var}
./build_rust-std.sh /usr/local /usr/local/src
./build.sh --prefix=/opt/local --scratch-path=/usr/local/src \
--without-python --state-dir=/usr/local/var/run/watchman --with-os-libs