CLI

The OpenClaw CLI is the primary interface for installing, onboarding, starting the gateway, managing configuration, installing plugins, running diagnostics, and controlling sessions and messaging.

Installation

Install globally with npm:

npm install -g openclaw@latest

From a source checkout in the pnpm workspace:

pnpm openclaw <command>

The CLI requires Node 24 (recommended) or Node 22.19+.

See Getting started for full setup instructions.

Onboarding

Run the recommended first-run command to set up the gateway, workspace, channels, and skills:

openclaw onboard
openclaw onboard --install-daemon

The --install-daemon flag installs a user-level launchd (macOS) or systemd (Linux) service. The command works on macOS, Linux, and Windows (with companion apps for mobile and desktop nodes).

Gateway control

The gateway subcommand starts and manages the control plane:

openclaw gateway
openclaw gateway status
openclaw gateway stop
openclaw gateway --port 18789 --verbose
openclaw gateway --bind lan --port 18789

Foreground mode supports --port, --verbose, and --bind (values: loopback, lan, tailnet, auto, or a custom host). Daemon supervision is handled by the service installed during onboarding. Health probes are available at /healthz and /readyz.

See Gateway configuration and Deployment for bind, auth, and container details.

Configuration

Manage ~/.openclaw/openclaw.json (JSON5 with $include support):

openclaw config get agents.defaults.workspace
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config unset plugins.entries.brave.config.webSearch.apiKey
openclaw config set agents.defaults.models '<json>' --strict-json --merge
openclaw config schema

get, set, and unset accept dotted paths. The schema command emits the current JSON Schema. Validation runs on load and hot reload; openclaw doctor --fix repairs invalid or clobbered entries.

Plugins

Install, inspect, and manage plugins:

openclaw plugins install <spec>
openclaw plugins inspect <id>

Plugins declare capabilities in openclaw.plugin.json manifests. The CLI surfaces bundled and external plugins, activation status, and compatibility warnings.

See Plugin SDK and Manifests and contracts for authoring details.

Diagnostics and repair

Run diagnostics and apply repairs:

openclaw doctor
openclaw doctor --fix
openclaw doctor --fix --yes

The command reports risky DM policies, config validation failures, port collisions, plugin load errors, and auth drift. --fix restores the last-known-good snapshot or repairs prefixed entries.

Other commands

  • Send test messages:

    openclaw message send --target <target> --message <text>
  • Interact with the agent:

    openclaw agent --message "text" [--thinking low|medium|high]
  • Approve DM pairing:

    openclaw pairing approve <channel> <code>
  • Manage nodes and devices:

    openclaw nodes ...
    openclaw devices ...
  • Switch release channels:

    openclaw update --channel stable|beta|dev
  • Write local config/workspace (source/dev use):

    openclaw setup

Sessions commands interact with the session store, transcripts, and bindings. See Sessions and transcripts for the underlying model.

Root options

Process root flags before subcommands:

  • --no-color: disable ANSI output.
  • --profile <name> or --dev: apply a named profile.
  • --container: target container layout (mutually exclusive with profile).
  • -v / --version: print version.
  • -h / --help: show help (fast-pathed for common commands).

Environment variables prefixed OPENCLAW_* override config and behavior. Use openclaw --help or openclaw help <command> for the current command list and flags.