---
name: macos dependencies
description: installs dependencies required to compile quantus-cli on macos
runs:
using: composite
steps:
- name: rust compilation prerequisites (macos)
run: |
brew update
OK=0
for i in 1 2 3; do
# protobuf only. Homebrew LLVM has no bottle on macos-15-intel and
# compiles from source for an hour-plus; bindgen can use Xcode's
# libclang (see LIBCLANG_PATH below).
if brew install protobuf; then OK=1; break; fi
echo "brew install attempt $i failed (often transient ghcr.io), retrying in 15s..."
sleep 15
done
if [ "$OK" -ne 1 ]; then echo "::error::brew install protobuf failed after 3 attempts"; exit 1; fi
curl https://sh.rustup.rs -sSf | sh -s -- -y
brew uninstall cmake
set +e
brew install openssl cmake 2>&1 | sed '/already installed and up-to-date/d'
brew_status=${PIPESTATUS[0]}
set -e
if [ "$brew_status" -ne 0 ]; then
exit "$brew_status"
fi
rustup toolchain install
rustup target add wasm32-unknown-unknown
rustup toolchain install nightly-2026-08-31 --profile minimal --component rustfmt
rustup component add clippy rust-src
shell: bash
- name: Set LIBCLANG_PATH for clang-sys (bindgen/rocksdb etc.)
run: |
# Prefer Xcode libclang so we never brew-build LLVM. Homebrew paths
# remain as fallbacks if someone already installed the formula.
DIR=
XC="$(xcode-select -p 2>/dev/null)/Toolchains/XcodeDefault.xctoolchain/usr/lib"
if [ -d "$XC" ] && ls "$XC"/libclang*.dylib 1>/dev/null 2>&1; then
DIR="$XC"
fi
if [ -z "$DIR" ] && command -v brew >/dev/null 2>&1; then
PREFIX="$(brew --prefix llvm 2>/dev/null)"
[ -n "$PREFIX" ] && [ -d "$PREFIX/lib" ] && ls "$PREFIX/lib"/libclang*.dylib 1>/dev/null 2>&1 && DIR="$PREFIX/lib"
fi
if [ -z "$DIR" ] && [ -d /usr/local/opt/llvm/lib ] && ls /usr/local/opt/llvm/lib/libclang*.dylib 1>/dev/null 2>&1; then
DIR=/usr/local/opt/llvm/lib
fi
if [ -z "$DIR" ] && [ -d /opt/homebrew/opt/llvm/lib ] && ls /opt/homebrew/opt/llvm/lib/libclang*.dylib 1>/dev/null 2>&1; then
DIR=/opt/homebrew/opt/llvm/lib
fi
if [ -n "$DIR" ]; then
echo "LIBCLANG_PATH=$DIR" >> $GITHUB_ENV
fi
echo "LIBCLANG_PATH=${LIBCLANG_PATH:-not set}"
shell: bash