When the OpenClaw gateway refuses to shut down, you feel it immediately: fans keep spinning, ports stay bound, and the agent continues to execute automations even after you “quit” the app. Because the gateway runs as a background service, closing the UI or signing out of your desktop session rarely kills the process. If you don’t tear it down cleanly, you end up with duplicate instances, unmountable drives, or lingering webhooks. This guide explains what is really happening and how to stop the service safely on every operating system.
TL;DR
- OpenClaw installs as a persistent service (
systemd --user,launchctl, orOpenClawGatewayon Windows), so quitting the UI does nothing. - Stop it the official way first (
openclaw gateway stop,openclaw gateway autostart disable). If it keeps respawning, remove the launch agent or service definition. - Validate with
systemctl --user status openclaw-gateway,launchctl list ai.openclaw.gateway, orGet-Service OpenClawGatewaybefore and after. - Once it’s down, clear lingering sockets/logs and rebuild autostart only if you actually need it.
Understand how the service is installed
OpenClaw deploys a background gateway the first time you run openclaw gateway start. The installer drops:
- Linux: a user-level
systemdunit~/.config/systemd/user/openclaw-gateway.serviceplus lingering enablement so it runs even when you log out. - macOS: a LaunchAgent plist
~/Library/LaunchAgents/ai.openclaw.gateway.plistthat respawns the gateway. - Windows: a Service Control Manager entry named
OpenClawGateway, plus a scheduled task that re-enables it if you disable autostart in the UI only. - Knowing which supervisor owns the process tells you which command actually stops it.
Quick triage before you pull the plug
Your AI Receptionist, Live in Minutes.
Scale your front desk with an AI that never sleeps. Solvea handles unlimited multi-channel inquiries, books appointments into your calendar automatically, and ensures zero missed opportunities around the clock.
Check active sessions: run openclaw status to see if any jobs are mid-run; aborting can orphan workflows.
Attempt a graceful stop: openclaw gateway stop --timeout 30. If it returns success, you’re done.
Confirm respawn logic: openclaw gateway autostart status shows whether a watcher will relaunch it.
Capture logs: tail ~/.openclaw/logs/gateway.log (Linux/macOS) or the Windows Event Log so you can confirm root cause after the fix.
Linux: stop the systemd user service
systemctl --user stop openclaw-gateway.service
systemctl --user disable openclaw-gateway.service
systemctl --user daemon-reload
loginctl disable-linger $USER (optional) to prevent auto-start after logout.
Verify with systemctl --user status openclaw-gateway — it should show inactive (dead).
If a rogue process remains, run pkill -f openclaw-gateway and delete the unit file before re-enabling.
macOS: unload the LaunchAgent
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl remove ai.openclaw.gateway 2>/dev/null
Delete the plist if you don’t want autostart: rm ~/Library/LaunchAgents/ai.openclaw.gateway.plist
Kill any remaining processes: pkill -f openclaw-gateway
Reboot or run openclaw gateway start only after you confirm the old PID is gone with ps aux | grep openclaw.
Windows: stop the SCM entry and scheduled task
Open PowerShell as admin and run Stop-Service -Name OpenClawGateway -Force
Set-Service -Name OpenClawGateway -StartupType Disabled
Delete the scheduled task that reboots it: Unregister-ScheduledTask -TaskName "OpenClaw Autostart" -Confirm:$false
If the PID lingers, run Stop-Process -Name openclaw -Force
Confirm with Get-Service OpenClawGateway — status should be Stopped.
You can also read MicroSoft doc.
When the service keeps relaunching itself
OpenClaw’s CLI can rebuild autostart helpers whenever you update or authenticate. Run these commands to reset expectations:
openclaw gateway autostart disable(turns off CLI-managed relaunchers)openclaw gateway doctor(reports orphaned units)- Delete stale sockets (Linux/macOS):
rm -f ~/.openclaw/run/gateway.sock - If the service restarts immediately, something else (e.g., a monitoring script or MDM profile) is calling
openclaw gateway start. Search your crontab,~/.config/openclaw/autostart.sh, and enterprise management tools.
Validate the shutdown
After you run the steps above:
- Processes:
ps, Task Manager, or Activity Monitor should show zeroopenclawentries. - Ports:
lsof -i :11434(replace with your OpenClaw port) should return nothing. - Logs: the last lines of the gateway log should include
Stopping gateway...and no new entries afterward. - Resource monitors: CPU and RAM usage should drop back to baseline.
Prevent recurrence
- Only enable autostart on machines that truly need 24/7 coverage.
- Document which users and hosts are running OpenClaw; duplicate installs often happen when teams share credentials.
- Schedule quarterly audits: list all
systemduser units, LaunchAgents, and Windows services named*openclaw*to detect drift. - Keep the CLI updated. Older builds sometimes ignore
stoprequests because the supervisor binary mismatches the gateway version.
Conclusion
A runaway OpenClaw background service is almost always a supervisor problem: the OS is doing exactly what you asked it to do—keep the gateway alive. Once you remove the unit, plist, or Windows service and double-check autostart flags, the process stays down. Treat the gateway like any other daemon: stop it cleanly, disable the watcher, confirm it’s dead, and then re-enable only when you’re ready. You can also uninstall OpenClaw as our guide.
FAQ
Why does OpenClaw come back immediately after I stop it?
Because the autostart watcher (systemd lingering, LaunchAgents, or a scheduled task) is still enabled. Disable the watcher before stopping the service.
Can I just kill the process from Activity Monitor or Task Manager?
You can, but it will likely restart unless you disable the service definition. Follow the OS-specific steps above to remove the supervisor entry first.
Is it safe to delete the LaunchAgent or systemd unit?
Yes, as long as you plan to reinstall or re-enable it later. The CLI can regenerate fresh units with openclaw gateway autostart enable once you need background mode again.






