[macOS] gateway restart fails to re-bootstrap LaunchAgent

Resolved 💬 2 comments Opened Mar 11, 2026 by qingjiaorousi666-blip Closed Mar 14, 2026

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

  1. Gateway is running normally via LaunchAgent (ai.openclaw.gateway)
  2. Edit ~/.openclaw/openclaw.json (e.g., change a model provider)
  3. Run openclaw gateway restart
  4. Gateway stops (receives SIGTERM)
  5. Run openclaw gateway startfails silently or gateway does not come back up
  6. launchctl list | grep openclawno output (LaunchAgent has been unloaded)

Expected Behavior

openclaw gateway restart should:

  1. Stop the gateway gracefully
  2. Automatically re-bootstrap the LaunchAgent
  3. Start the gateway — all in one seamless operation

Actual Behavior

  • restart calls launchctl bootout gui/<UID>/ai.openclaw.gateway, which permanently removes the LaunchAgent from launchd
  • The start phase does not call launchctl bootstrap to 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 restart requires 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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗