Daemon Setup

Running OpenClaw as a Daemon

For production use, OpenClaw should run as a persistent background service that starts on boot and restarts on failure.

macOS: launchd

Create a plist file at ~/Library/LaunchAgents/ai.openclaw.gateway.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>ai.openclaw.gateway</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/openclaw</string>
    <string>start</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <true/>
  <key>StandardOutPath</key>
  <string>/tmp/openclaw.stdout.log</string>
  <key>StandardErrorPath</key>
  <string>/tmp/openclaw.stderr.log</string>
</dict>
</plist>

Load and start the service:

launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl start ai.openclaw.gateway

Managing the Service

# Check status
launchctl list | grep openclaw

# Stop
launchctl stop ai.openclaw.gateway

# Unload (disable)
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Linux: systemd

Create a service file at /etc/systemd/system/openclaw.service:

[Unit]
Description=OpenClaw Gateway
After=network.target

[Service]
Type=simple
User=your-username
ExecStart=/usr/local/bin/openclaw start
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw

Managing the Service

# Check status
sudo systemctl status openclaw

# View logs
journalctl -u openclaw -f

# Restart
sudo systemctl restart openclaw

Monitoring

Once running as a daemon, monitor your agent with:

# Check gateway health
curl http://127.0.0.1:18789/health

# View recent logs
openclaw logs --tail 50

Next Steps

Last updated: 2026-03-10

Related Articles