Paozhu logoPaozhu Docs
Documentation
INSTALL

macOS installation

Prepare C++20 dependencies with Homebrew, then build and run paozhu.

1. Install dependencies

Required dependencies are Asio, OpenSSL, Zlib, Brotli and CMake. GD and qrencode are only needed when ENABLE_GD=ON.

terminalbash
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

brew install asio cmake openssl zlib brotli
# optional only when ENABLE_GD=ON
brew install gd qrencode

2. Build and run

CMake defaults to Debug with ASan; use Release for production. The binary is written to bin/. The default httpport=80 needs root or a port change.

terminalbash
cd paozhu
[ -f asio/asio.hpp ] || unzip asio.zip
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(sysctl -n hw.ncpu)
cd ..

# port 80 needs root; or change httpport in conf/server.conf
sudo ./bin/paozhu conf/server.conf

3. Use Ninja (optional)

If a generator mismatch appears, delete CMakeCache.txt and CMakeFiles before reconfiguring.

terminalbash
brew install ninja
cd build
rm -rf CMakeCache.txt CMakeFiles
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
cd ..
sudo ./bin/paozhu conf/server.conf

4. Verify

Open http://localhost/hello. If the port is busy, use lsof -i :80 and change httpport in conf/server.conf.