Files
openclaw/docs/platforms/mac/bundled-gateway.md
T
Dallin Romney 7bbd09047b docs: simplify macOS app overview (#97120)
* docs: simplify macOS app docs

* docs: preserve macOS app detail links

* docs: address macOS review feedback
2026-06-27 16:04:30 -07:00

3.2 KiB

summary, read_when, title
summary read_when title
Gateway runtime on macOS (external launchd service)
Packaging OpenClaw.app
Debugging the macOS gateway launchd service
Installing the gateway CLI for macOS
Gateway on macOS

OpenClaw.app no longer bundles Node/Bun or the Gateway runtime. The macOS app expects an external openclaw CLI install, does not spawn the Gateway as a child process, and manages a per-user launchd service to keep the Gateway running (or attaches to an existing local Gateway if one is already running).

Install the CLI (required for local mode)

Node 24 is the default runtime on the Mac. Node 22 LTS, currently 22.19+, still works for compatibility. Then install openclaw globally:

npm install -g openclaw@<version>

The macOS app's Install CLI button runs the same global install flow the app uses internally: it prefers npm first, then pnpm, then bun if that is the only detected package manager. Node remains the recommended Gateway runtime.

Launchd (Gateway as LaunchAgent)

Label:

  • ai.openclaw.gateway (or ai.openclaw.<profile>; legacy com.openclaw.* may remain)

Plist location (per-user):

  • ~/Library/LaunchAgents/ai.openclaw.gateway.plist (or ~/Library/LaunchAgents/ai.openclaw.<profile>.plist)

Manager:

  • The macOS app owns LaunchAgent install/update in Local mode.
  • The CLI can also install it: openclaw gateway install.

Behavior:

  • "OpenClaw Active" enables/disables the LaunchAgent.
  • App quit does not stop the gateway (launchd keeps it alive).
  • If a Gateway is already running on the configured port, the app attaches to it instead of starting a new one.

Logging:

  • launchd stdout: ~/Library/Logs/openclaw/gateway.log (profiles use gateway-<profile>.log)
  • launchd stderr: suppressed

Version compatibility

The macOS app checks the gateway version against its own version. If they're incompatible, update the global CLI to match the app version.

State directory on macOS

Keep OpenClaw state on a local, non-synced disk. Avoid iCloud Drive and other cloud-synced folders because sync latency and file locks can affect sessions, credentials, and Gateway state.

Set OPENCLAW_STATE_DIR to a local path only when you need an override. openclaw doctor warns about common cloud-synced state paths and recommends moving back to local storage. See environment variables and Doctor.

Debug app connectivity

Use the macOS debug CLI from a source checkout to exercise the same Gateway WebSocket handshake and discovery logic the app uses:

cd apps/macos
swift run openclaw-mac connect --json
swift run openclaw-mac discover --timeout 3000 --json

connect accepts --url, --token, --timeout, and --json. discover accepts --timeout, --json, and --include-local. Compare discovery output with openclaw gateway discover --json when you need to separate CLI discovery from app-side connection issues.

Smoke check

openclaw --version

OPENCLAW_SKIP_CHANNELS=1 \
OPENCLAW_SKIP_CANVAS_HOST=1 \
openclaw gateway --port 18999 --bind loopback

Then:

openclaw gateway call health --url ws://127.0.0.1:18999 --timeout 3000