[macOS] gateway restart fails to re-bootstrap LaunchAgent
openclaw gateway restart fails to re-bootstrap LaunchAgent on macOS
Summary
openclaw gateway restart on macOS stops the gateway but does not automatically re-register the LaunchAgent with launchd. After restart, the gateway cannot be started with openclaw gateway start — users must manually run openclaw gateway install first to re-bootstrap the LaunchAgent.
Environment
- OpenClaw: 2026.3.8 (3caab92)
- macOS: 26.3.1 (Build 25D2128), Apple Silicon (arm64)
- Node: v22.22.1
- launchctl: Darwin Bootstrapper 7.0.0
Steps to Reproduce
- Gateway is running normally via LaunchAgent (
ai.openclaw.gateway) - Edit
~/.openclaw/openclaw.json(e.g., change a model provider) - Run
openclaw gateway restart - Gateway stops (receives SIGTERM)
- Run
openclaw gateway start— fails silently or gateway does not come back up launchctl list | grep openclaw— no output (LaunchAgent has been unloaded)
Expected Behavior
openclaw gateway restart should:
- Stop the gateway gracefully
- Automatically re-bootstrap the LaunchAgent
- Start the gateway — all in one seamless operation
Actual Behavior
restartcallslaunchctl bootout gui/<UID>/ai.openclaw.gateway, which permanently removes the LaunchAgent from launchd- The
startphase does not calllaunchctl bootstrapto re-register it - Gateway remains down until the user manually runs
openclaw gateway install && openclaw gateway start
Evidence from Logs
# Gateway receives SIGTERM and shuts down
2026-03-12T00:16:18.267+08:00 [gateway] signal SIGTERM received
2026-03-12T00:16:18.268+08:00 [gateway] received SIGTERM; shutting down
# 5-minute gap — gateway is completely down
# Gateway starts but immediately receives another SIGTERM (from stale bootout?)
2026-03-12T00:21:32.146+08:00 [gateway] signal SIGTERM received
2026-03-12T00:21:32.148+08:00 [gateway] received SIGTERM; shutting down
# Finally starts after manual `install`
2026-03-12T00:21:36.550+08:00 [canvas] host mounted at http://127.0.0.1:18789/...
Workaround
Instead of openclaw gateway restart, use:
openclaw gateway stop && openclaw gateway install && openclaw gateway start
Or better yet: don't restart at all. Most config changes in openclaw.json are hot-reloaded automatically (confirmed in logs: config hot reload applied).
Suggested Fix
In the restart command implementation, after launchctl bootout, immediately call launchctl bootstrap (or the equivalent install logic) before attempting start. Alternatively, use launchctl kickstart -k which restarts the service in-place without unloading it.
Impact
- Every
gateway restartrequires manual intervention (install+start) - During the gap, all connected channels (Feishu bots, webchat, etc.) are offline
- Users may not realize the gateway is down until they notice messages aren't being delivered
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗