Skip to content

Installing OpenClaw and walking through the first run

A clean install of OpenClaw on macOS or Linux, from one-line installer through dashboard handshake — with the verification checks that catch a bad daemon, a wrong Node version, or a stale onboarding state before you wire up real channels.

You read the openclaw.ai page, the install command is one line, and the README promises a two-minute onboard. So you curl | bash, run openclaw onboard, hit a prompt for an API key, paste one in, and a minute later the dashboard opens in your browser. Half the time it works. The other half the daemon never comes up because Node 20 is on the PATH instead of Node 22, the install dropped into a directory the shell does not know about, the onboarding writes a config you cannot find, or the Gateway is listening but the channel pairing code from the dashboard never reaches your phone. This walkthrough is the install with the verification checks that turn “it worked on my machine” into “it is actually wired correctly.”

Outcome and prerequisites

By the end you will have:

  • The openclaw CLI on your PATH at a known version
  • A running Gateway daemon listening on 127.0.0.1:18789
  • A populated ~/.openclaw/ directory with openclaw.json, the workspace, and the initial session store
  • The Control UI reachable in a browser
  • A first round-trip from the Control UI chat back to the agent, against a real LLM backend

Prerequisites:

  • macOS 13+ (15+ for the bundled Pi macOS app), Ubuntu 22.04+, Debian 12+, or Fedora 38+
  • Node.js 22.16+ — Node 24 recommended (Node.js docs; OpenClaw docs)
  • An API key for one of the supported LLM backends — Anthropic (Anthropic docs), OpenAI (OpenAI docs), Google, or a reachable local backend like Ollama (Ollama docs)
  • Outbound HTTPS to the provider you choose

Allow root or sudo access for the package install steps. The OpenClaw daemon itself runs as your user, not root.

Estimated time

15 minutes for the install, plus the API-key turnaround at your LLM provider.

Steps

1. Verify Node.js is on a supported version

OpenClaw needs Node 22.16+ at minimum, with Node 24 recommended (OpenClaw docs). Check the version actually on your PATH:

node --version
# v22.16.0  (or v24.x.x)

which node
# /usr/local/bin/node   on macOS
# /usr/bin/node         on Linux distros

If you have Node 20 or older, install Node 22 or 24 from the official Node.js distribution or use nvm:

nvm install 22
nvm alias default 22
nvm use 22

If node --version and nvm current disagree, you have an inactive shell — open a fresh terminal before continuing.

2. Run the OpenClaw installer

The recommended path on macOS and Linux is the one-line script:

curl -fsSL https://openclaw.ai/install.sh | bash

This downloads the installer, drops the runtime into a managed location, and adds the openclaw binary to your PATH. If you prefer the npm path because you already manage Node globally, install the package directly:

npm i -g openclaw

Either path installs the same openclaw CLI. The shell-script path also installs the bundled Pi runtime that the agent uses internally. Confirm the binary is reachable:

which openclaw
openclaw --version

If openclaw is not found, re-source your shell init file (source ~/.zshrc or source ~/.bashrc) and check again before debugging further.

3. Run the onboard wizard

The onboard wizard creates ~/.openclaw/openclaw.json, picks an LLM provider, captures the API key, and installs the Gateway daemon:

openclaw onboard --install-daemon

You will be prompted for:

  • A model provider (Anthropic, OpenAI, Google, MiniMax, Ollama, or one of the other registered providers from the integrations list)
  • An API key for that provider, or an endpoint URL for a local backend
  • The display name and persona for the agent
  • Optional channel pairing for a first chat surface

The wizard writes the config, starts the Gateway, and prints the Control UI URL — usually http://127.0.0.1:18789/. If you skip --install-daemon, the Gateway runs in your foreground shell until you exit; the daemon mode is the production path.

4. Open the Control UI

Open the printed URL in a browser. You should see a chat interface with your agent’s name, a sidebar listing channels (none yet, if you skipped channel pairing), and a status indicator showing the Gateway is healthy.

Send a first message in the chat. The agent should respond using the model you picked — a token-by-token stream if the provider supports streaming, a single block otherwise.

5. Confirm the daemon is registered

The Gateway should now be running as a system daemon. On macOS this is a launchd user agent; on Linux it is a systemd user service:

# macOS
launchctl list | grep openclaw

# Linux
systemctl --user status openclaw-gateway

If the daemon is not listed, the foreground process is still running but it will not survive a reboot. Re-run openclaw onboard --install-daemon or refer to the docs for the daemon-install incantation on your platform.

Verification

Four checks must all pass before you wire up real channels.

The Gateway is listening on 127.0.0.1, not 0.0.0.0:

ss -lntp 2>/dev/null | grep :18789 || lsof -nP -iTCP:18789 -sTCP:LISTEN
# Expected: 127.0.0.1:18789 (Linux: ss output; macOS: lsof output)

If the Gateway is bound to 0.0.0.0, it is reachable from your local network — fine on a single-user laptop, not fine on a shared host. Adjust gateway.bind in ~/.openclaw/openclaw.json to "127.0.0.1" and restart the Gateway.

The config file is in the expected location:

ls -la ~/.openclaw/
# openclaw.json
# workspace/
# agents/
# cron/

If ~/.openclaw/ is empty, the onboard wizard wrote elsewhere — check $OPENCLAW_HOME, $OPENCLAW_STATE_DIR, and $OPENCLAW_CONFIG_PATH in your environment (OpenClaw docs).

The LLM backend is wired correctly:

openclaw agent --message "respond with the single word OK" --thinking low

This makes one round-trip through the agent runtime to the configured model. A reply of OK (or a short OK-shaped response) confirms the API key, the model id, and the network path. A failure mode here is almost always an authentication error — re-check the API key.

The dashboard responds over HTTP:

curl -fsS http://127.0.0.1:18789/api/health
# {"status":"ok"} or similar — non-empty 200

If this hangs or 502s, the Gateway is up but the dashboard worker has not registered. Check the gateway logs:

openclaw logs --follow

Rollback

OpenClaw is a single-user install with all state under ~/.openclaw/. To roll back to a clean machine:

# 1. Stop the daemon
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist 2>/dev/null
systemctl --user stop openclaw-gateway 2>/dev/null
systemctl --user disable openclaw-gateway 2>/dev/null

# 2. Uninstall the CLI
npm uninstall -g openclaw

# 3. Archive state (do not delete yet — recovery is easier if you keep it)
mv ~/.openclaw ~/.openclaw.removed.$(date +%F-%H%M%S)

Keep the archived ~/.openclaw/ directory until you are sure you do not need any session transcripts or custom skills back. The workspace under it is plain markdown and JSONL — recovering specific bits is straightforward.

Troubleshooting

openclaw: command not found after install. The installer placed the binary outside your PATH. Re-source your shell init file. If still missing, run which corepack to confirm Node was installed correctly, then re-run the install script.

Gateway exits immediately on start. The most common cause is Node version. openclaw --version should print something; if the runtime fails before that, run node --version and confirm 22.16+.

Onboard wizard exits without writing config. Make sure ~/.openclaw/ is writable by your user. If the directory exists but is owned by root (rare, but happens if you sudo’d the install), chown it back: sudo chown -R $(whoami) ~/.openclaw.

Control UI loads but the chat hangs on every message. The model API call is failing. Open openclaw logs --follow in a second terminal and resend a message — a 401 means the API key is wrong, a 429 means rate-limited, a timeout means the provider is unreachable.

Telegram or Slack pairing code never arrives on your phone. The channel worker is not running. Confirm channels.<provider>.enabled is true in openclaw.json and the bot token is correct. See the channel-specific docs for token retrieval (OpenClaw docs — Telegram channel).

Production-readiness checklist

Before you put OpenClaw on a host that anyone else relies on:

  • Node version is pinned (24 recommended, 22.16+ supported) and survives a reboot
  • Gateway bound to 127.0.0.1, not 0.0.0.0
  • LLM API key in a secrets manager, not in openclaw.json plaintext for shared hosts — use the env config section to inject from environment
  • ~/.openclaw/ directory included in the host’s backup job (workspace, sessions, cron, config)
  • Daemon installed under your user’s launchd or systemd, not running in a foreground shell
  • openclaw logs output going somewhere durable (system logs or a file you ship), not just stdout
  • Channel dmPolicy set to pairing or allowlist, never open, on any channel reachable from outside your trust boundary

Sources


Last verified on OpenClaw current. Re-check the install command on https://openclaw.ai before running on a fresh host — the entry-point script does evolve.

Talk to a senior operator about your OpenClaw deployment.