Skip to content

Commit fc7424c

Browse files
OpenClawOpenClaw
authored andcommitted
docs: fix launchd PATH in macOS watchdog example
1 parent 767a67a commit fc7424c

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

docs/platforms/mac/bundled-gateway.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,22 @@ Example watchdog script:
100100
#!/bin/zsh
101101
set -euo pipefail
102102

103-
if openclaw health --json >/dev/null 2>&1; then
103+
# launchd uses a minimal PATH. Replace this if your install lives elsewhere
104+
# (for example nvm, pnpm, Homebrew on Apple Silicon, or a custom prefix).
105+
OPENCLAW_BIN="${OPENCLAW_BIN:-/opt/homebrew/bin/openclaw}"
106+
107+
if "$OPENCLAW_BIN" health --json >/dev/null 2>&1; then
104108
exit 0
105109
fi
106110

107-
openclaw doctor >/dev/null 2>&1 || true
108-
openclaw doctor --fix >/dev/null 2>&1 || true
109-
openclaw gateway restart >/dev/null 2>&1 || true
111+
"$OPENCLAW_BIN" doctor >/dev/null 2>&1 || true
112+
"$OPENCLAW_BIN" doctor --fix >/dev/null 2>&1 || true
113+
"$OPENCLAW_BIN" gateway restart >/dev/null 2>&1 || true
110114
```
111115

116+
Before loading the watchdog, verify the binary path with `which openclaw` and
117+
update `OPENCLAW_BIN` if needed.
118+
112119
Example LaunchAgent (`~/Library/LaunchAgents/ai.openclaw.gateway-watchdog.plist`):
113120

114121
```xml
@@ -123,6 +130,11 @@ Example LaunchAgent (`~/Library/LaunchAgents/ai.openclaw.gateway-watchdog.plist`
123130
<string>/bin/zsh</string>
124131
<string>/Users/YOU/.openclaw/bin/gateway-watchdog.sh</string>
125132
</array>
133+
<key>EnvironmentVariables</key>
134+
<dict>
135+
<key>PATH</key>
136+
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
137+
</dict>
126138
<key>StartInterval</key>
127139
<integer>60</integer>
128140
<key>RunAtLoad</key>

0 commit comments

Comments
 (0)