Skip to main content

openclaw daemon

Manage the OpenClaw Gateway as a system background service.

Usage

Commands

install

Install the gateway as a system service.
Installs the appropriate service for your platform:
  • macOS: LaunchAgent (~/Library/LaunchAgents/ai.openclaw.gateway.plist)
  • Linux: systemd user service (~/.config/systemd/user/openclaw-gateway.service)
  • Windows: Task Scheduler task
boolean
Overwrite existing service configuration

start

Start the gateway service.
Starts the installed service using the platform’s service manager:
  • macOS: launchctl load
  • Linux: systemctl --user start
  • Windows: schtasks /run

stop

Stop the gateway service.
Stops the running service:
  • macOS: launchctl unload
  • Linux: systemctl --user stop
  • Windows: schtasks /end

restart

Restart the gateway service.
Equivalent to running stop followed by start.

status

Show service install status and probe the Gateway.
boolean
Output JSON format

uninstall

Remove the gateway service.
Removes the service configuration:
  • macOS: Removes LaunchAgent plist
  • Linux: Removes systemd service unit
  • Windows: Removes Task Scheduler task
Uninstalling stops the service and removes the service configuration, but does not delete the OpenClaw installation or configuration.

Examples

Platform Details

macOS (LaunchAgent)

The service is installed as a LaunchAgent at:

Service Configuration

The plist includes:
  • Automatic startup on login
  • Standard output/error logging
  • Restart on crash
  • Environment variables

Manual Management

Linux (systemd)

The service is installed as a user service at:

Service Configuration

The unit file includes:
  • User service (no root required)
  • Restart on failure
  • Standard output to journal
  • Environment variables

User Lingering

For the service to run when not logged in, enable lingering:
Without lingering enabled, systemd stops user services on logout. The doctor command will detect this and offer to enable lingering.

Manual Management

Windows (Task Scheduler)

The service is installed as a scheduled task.

Service Configuration

  • Runs on user login
  • Background execution
  • Restart on failure

Manual Management

For Windows, WSL2 is recommended for better compatibility. Install OpenClaw in WSL2 and use systemd for service management.

Environment Variables

The daemon service inherits environment variables from:
  1. Service configuration (set during install)
  2. User environment (shell profile)
  3. Config file (~/.openclaw/openclaw.json)
Common environment variables:
string
Gateway authentication token
string
Gateway authentication password
string
Node environment (production, development)
string
Configuration profile name

Logging

Service logs are managed by the platform’s logging system:

macOS Unified Logs

Linux systemd Journal

Via OpenClaw CLI

Use the logs command to view gateway logs:

Troubleshooting

Service Won’t Start

  1. Check installation:
  2. Check gateway config:
  3. Run diagnostics:
  4. Try manual start:

Service Crashes Immediately

  1. Check logs:
  2. Check port availability:
  3. Check authentication:

Service Stops on Logout (Linux)

Enable user lingering:
Verify:
Should show Linger=yes.

Permission Errors

Ensure the service runs as your user (not root):

Automatic Startup

By default, the daemon starts automatically:
  • macOS: On user login (LaunchAgent)
  • Linux: When systemd user session starts (requires lingering)
  • Windows: On user login (Task Scheduler)
To disable automatic startup:

macOS

Linux

Windows

  • gateway - Run gateway directly (foreground)
  • logs - View gateway logs
  • status - Check overall system status
  • doctor - Diagnose service issues