TL;DR: alphaclaw (@chrysb/alphaclaw) was written for Linux/Docker with root access. On macOS it writes to /usr/local/bin/ and /etc/cron.d/ which require root. Redirect to ~/.local/bin/ and user crontab. setup_macos.py applies these patches idempotently on every boot.
| Startup error | Root cause | Fix |
|---|---|---|
gog install skipped: Permission denied /usr/local/bin/gog |
/usr/local/bin/ is root:wheel on macOS |
Change dest to ~/.local/bin/gog |
Cron setup skipped: ENOENT /etc/cron.d/openclaw-hourly-sync |
/etc/cron.d/ is Linux-only |
macOS: use crontab -l user crontab |
systemctl shim skipped: EACCES /usr/local/bin/systemctl |
Linux/Docker-only shim | Wrap in if (os.platform() !== "darwin") |
git auth shim skipped: EACCES /usr/local/bin/git |
git shim dest hardcoded to root-owned path | Change to ~/.local/bin/git |
Gateway timed out after 30s |
gateway exits on JSON schema error (models undefined) |
Add models[] arrays to ollama providers in openclaw.json |
# 1. Is the port open?
nc -z 127.0.0.1 18789 # if nothing: gateway never started
# 2. Run gateway directly to see schema errors
openclaw gateway run # schema errors print immediately
# 3. Validate config
openclaw doctor # shows validation errors
# openclaw doctor --fix # fixes permissions but NOT missing models[] arrays (manual edit required)
# 4. Once openclaw.json is valid, port opens within ~4smacOS PATH order: ~/.local/bin (pos 4) → /usr/local/bin (pos 9).
Installing binaries to ~/.local/bin shadows system paths without sudo. This is the correct macOS pattern for any npm/pip tool that tries to write to root-owned paths.
Called from start.sh on every boot via:
python "$SCRIPT_DIR/setup_macos.py" --quiet 2>&1 | sed 's/^/ /' || trueWhat it does (all idempotent):
- Creates
~/.local/bin, adds it to PATH in~/.zshrcif missing - Validates
~/.openclaw/openclaw.json— addsmodels[]arrays if missing; queries live Ollama for real names - Applies 6 alphaclaw.js patches — each has a
detectstring (already-patched marker); skips if already applied - Writes
~/.alphaclaw/.macos_patches.jsonmarker file
Idempotency contract: each patch checks detect in content before applying. Warns if npm package version changed (KNOWN_ALPHACLAW_VERSION = "0.9.3" constant) but still attempts patches.
- npm packages designed for Docker/root will fail on macOS — check for
/usr/local/bin/writes and/etc/cron.d/references; redirect to~/.local/bin/and user crontab openclaw.jsonschema validation is strict — gateway exits immediately on failure; check config first before troubleshooting port timeouts- Gateway timeout ≠ gateway crash — if port never opens, look at config validation first
- All pre-flight patches must be idempotent —
detectstring (patched marker) +oldstring (original marker); apply only whenoldis found - node_modules patches are transient —
npm installoverwrites alphaclaw.js;setup_macos.pyre-applies on next boot