Files
openclaw/docs/start/setup.md

166 lines
4.9 KiB
Markdown
Raw Normal View History

2026-01-01 15:43:15 +01:00
---
summary: "Advanced setup and development workflows for OpenClaw"
2026-01-01 15:43:15 +01:00
read_when:
- Setting up a new machine
- You want “latest + greatest” without breaking your personal setup
title: "Setup"
2026-01-01 15:43:15 +01:00
---
# Setup
<Note>
If you are setting up for the first time, start with [Getting Started](/start/getting-started).
For wizard details, see [Onboarding Wizard](/start/wizard).
</Note>
2026-01-01 15:43:15 +01:00
Last updated: 2026-01-01
## TL;DR
2026-01-31 21:13:13 +09:00
2026-01-30 03:15:10 +01:00
- **Tailoring lives outside the repo:** `~/.openclaw/workspace` (workspace) + `~/.openclaw/openclaw.json` (config).
2026-01-01 15:43:15 +01:00
- **Stable workflow:** install the macOS app; let it run the bundled Gateway.
- **Bleeding edge workflow:** run the Gateway yourself via `pnpm gateway:watch`, then let the macOS app attach in Local mode.
2026-01-01 15:43:15 +01:00
## Prereqs (from source)
2026-01-31 21:13:13 +09:00
2026-01-01 15:43:15 +01:00
- Node `>=22`
- `pnpm`
2026-01-10 14:51:21 -06:00
- Docker (optional; only for containerized setup/e2e — see [Docker](/install/docker))
2026-01-01 15:43:15 +01:00
## Tailoring strategy (so updates dont hurt)
2026-01-31 21:13:13 +09:00
If you want “100% tailored to me” _and_ easy updates, keep your customization in:
2026-01-01 15:43:15 +01:00
2026-01-30 03:15:10 +01:00
- **Config:** `~/.openclaw/openclaw.json` (JSON/JSON5-ish)
- **Workspace:** `~/.openclaw/workspace` (skills, prompts, memories; make it a private git repo)
2026-01-01 15:43:15 +01:00
Bootstrap once:
```bash
2026-01-30 03:15:10 +01:00
openclaw setup
2026-01-01 15:43:15 +01:00
```
From inside this repo, use the local CLI entry:
```bash
2026-01-30 03:15:10 +01:00
openclaw setup
2026-01-01 15:43:15 +01:00
```
2026-01-30 03:15:10 +01:00
If you dont have a global install yet, run it via `pnpm openclaw setup`.
2026-01-20 07:42:21 +00:00
## Run the Gateway from this repo
After `pnpm build`, you can run the packaged CLI directly:
```bash
node openclaw.mjs gateway --port 18789 --verbose
```
2026-01-01 15:43:15 +01:00
## Stable workflow (macOS app first)
2026-01-31 21:13:13 +09:00
1. Install + launch **OpenClaw.app** (menu bar).
2. Complete the onboarding/permissions checklist (TCC prompts).
3. Ensure Gateway is **Local** and running (the app manages it).
4. Link surfaces (example: WhatsApp):
2026-01-01 15:43:15 +01:00
```bash
2026-01-30 03:15:10 +01:00
openclaw channels login
2026-01-01 15:43:15 +01:00
```
5. Sanity check:
2026-01-01 15:43:15 +01:00
```bash
2026-01-30 03:15:10 +01:00
openclaw health
2026-01-01 15:43:15 +01:00
```
2026-01-08 23:06:56 +01:00
If onboarding is not available in your build:
2026-01-31 21:13:13 +09:00
2026-01-30 03:15:10 +01:00
- Run `openclaw setup`, then `openclaw channels login`, then start the Gateway manually (`openclaw gateway`).
2026-01-01 15:43:15 +01:00
## Bleeding edge workflow (Gateway in a terminal)
Goal: work on the TypeScript Gateway, get hot reload, keep the macOS app UI attached.
### 0) (Optional) Run the macOS app from source too
If you also want the macOS app on the bleeding edge:
```bash
./scripts/restart-mac.sh
```
### 1) Start the dev Gateway
```bash
pnpm install
pnpm gateway:watch
```
2026-01-08 23:06:56 +01:00
`gateway:watch` runs the gateway in watch mode and reloads on TypeScript changes.
2026-01-01 15:43:15 +01:00
### 2) Point the macOS app at your running Gateway
2026-01-30 03:15:10 +01:00
In **OpenClaw.app**:
2026-01-01 15:43:15 +01:00
- Connection Mode: **Local**
2026-01-31 21:13:13 +09:00
The app will attach to the running gateway on the configured port.
2026-01-01 15:43:15 +01:00
### 3) Verify
- In-app Gateway status should read **“Using existing gateway …”**
- Or via CLI:
```bash
2026-01-30 03:15:10 +01:00
openclaw health
2026-01-01 15:43:15 +01:00
```
### Common footguns
2026-01-31 21:13:13 +09:00
2026-01-01 15:43:15 +01:00
- **Wrong port:** Gateway WS defaults to `ws://127.0.0.1:18789`; keep app + CLI on the same port.
- **Where state lives:**
2026-01-30 03:15:10 +01:00
- Credentials: `~/.openclaw/credentials/`
- Sessions: `~/.openclaw/agents/<agentId>/sessions/`
- Logs: `/tmp/openclaw/`
2026-01-01 15:43:15 +01:00
2026-01-26 19:58:54 +00:00
## Credential storage map
Use this when debugging auth or deciding what to back up:
2026-01-30 03:15:10 +01:00
- **WhatsApp**: `~/.openclaw/credentials/whatsapp/<accountId>/creds.json`
2026-01-26 19:58:54 +00:00
- **Telegram bot token**: config/env or `channels.telegram.tokenFile`
- **Discord bot token**: config/env or SecretRef (env/file/exec providers)
2026-01-26 19:58:54 +00:00
- **Slack tokens**: config/env (`channels.slack.*`)
- **Pairing allowlists**:
- `~/.openclaw/credentials/<channel>-allowFrom.json` (default account)
- `~/.openclaw/credentials/<channel>-<accountId>-allowFrom.json` (non-default accounts)
2026-01-30 03:15:10 +01:00
- **Model auth profiles**: `~/.openclaw/agents/<agentId>/agent/auth-profiles.json`
- **File-backed secrets payload (optional)**: `~/.openclaw/secrets.json`
2026-01-30 03:15:10 +01:00
- **Legacy OAuth import**: `~/.openclaw/credentials/oauth.json`
2026-01-31 21:13:13 +09:00
More detail: [Security](/gateway/security#credential-storage-map).
2026-01-26 19:58:54 +00:00
2026-01-01 15:43:15 +01:00
## Updating (without wrecking your setup)
2026-01-30 03:15:10 +01:00
- Keep `~/.openclaw/workspace` and `~/.openclaw/` as “your stuff”; dont put personal prompts/config into the `openclaw` repo.
2026-01-01 15:43:15 +01:00
- Updating source: `git pull` + `pnpm install` (when lockfile changed) + keep using `pnpm gateway:watch`.
## Linux (systemd user service)
Linux installs use a systemd **user** service. By default, systemd stops user
services on logout/idle, which kills the Gateway. Onboarding attempts to enable
lingering for you (may prompt for sudo). If its still off, run:
```bash
sudo loginctl enable-linger $USER
```
For always-on or multi-user servers, consider a **system** service instead of a
2026-01-10 14:51:21 -06:00
user service (no lingering needed). See [Gateway runbook](/gateway) for the systemd notes.
2026-01-01 15:43:15 +01:00
## Related docs
2026-01-10 14:51:21 -06:00
- [Gateway runbook](/gateway) (flags, supervision, ports)
- [Gateway configuration](/gateway/configuration) (config schema + examples)
- [Discord](/channels/discord) and [Telegram](/channels/telegram) (reply tags + replyToMode settings)
2026-01-30 03:15:10 +01:00
- [OpenClaw assistant setup](/start/openclaw)
- [macOS app](/platforms/macos) (gateway lifecycle)