2026-01-26 12:59:06 -08:00
|
|
|
|
---
|
2026-01-30 03:15:10 +01:00
|
|
|
|
summary: "Move (migrate) a OpenClaw install from one machine to another"
|
2026-01-26 12:59:06 -08:00
|
|
|
|
read_when:
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- You are moving OpenClaw to a new laptop/server
|
2026-01-26 12:59:06 -08:00
|
|
|
|
- You want to preserve sessions, auth, and channel logins (WhatsApp, etc.)
|
2026-01-31 16:04:03 -05:00
|
|
|
|
title: "Migration Guide"
|
2026-01-26 12:59:06 -08:00
|
|
|
|
---
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
# Migrating OpenClaw to a new machine
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
This guide migrates a OpenClaw Gateway from one machine to another **without redoing onboarding**.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
The migration is simple conceptually:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- Copy the **state directory** (`$OPENCLAW_STATE_DIR`, default: `~/.openclaw/`) — this includes config, auth, sessions, and channel state.
|
|
|
|
|
|
- Copy your **workspace** (`~/.openclaw/workspace/` by default) — this includes your agent files (memory, prompts, etc.).
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
But there are common footguns around **profiles**, **permissions**, and **partial copies**.
|
|
|
|
|
|
|
|
|
|
|
|
## Before you start (what you are migrating)
|
|
|
|
|
|
|
|
|
|
|
|
### 1) Identify your state directory
|
|
|
|
|
|
|
|
|
|
|
|
Most installs use the default:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- **State dir:** `~/.openclaw/`
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
But it may be different if you use:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `--profile <name>` (often becomes `~/.openclaw-<profile>/`)
|
|
|
|
|
|
- `OPENCLAW_STATE_DIR=/some/path`
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
If you’re not sure, run on the **old** machine:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw status
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
Look for mentions of `OPENCLAW_STATE_DIR` / profile in the output. If you run multiple gateways, repeat for each profile.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
### 2) Identify your workspace
|
|
|
|
|
|
|
|
|
|
|
|
Common defaults:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `~/.openclaw/workspace/` (recommended workspace)
|
2026-01-26 12:59:06 -08:00
|
|
|
|
- a custom folder you created
|
|
|
|
|
|
|
|
|
|
|
|
Your workspace is where files like `MEMORY.md`, `USER.md`, and `memory/*.md` live.
|
|
|
|
|
|
|
|
|
|
|
|
### 3) Understand what you will preserve
|
|
|
|
|
|
|
|
|
|
|
|
If you copy **both** the state dir and workspace, you keep:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- Gateway configuration (`openclaw.json`)
|
2026-01-26 12:59:06 -08:00
|
|
|
|
- Auth profiles / API keys / OAuth tokens
|
|
|
|
|
|
- Session history + agent state
|
|
|
|
|
|
- Channel state (e.g. WhatsApp login/session)
|
|
|
|
|
|
- Your workspace files (memory, skills notes, etc.)
|
|
|
|
|
|
|
|
|
|
|
|
If you copy **only** the workspace (e.g., via Git), you do **not** preserve:
|
|
|
|
|
|
|
|
|
|
|
|
- sessions
|
|
|
|
|
|
- credentials
|
|
|
|
|
|
- channel logins
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
Those live under `$OPENCLAW_STATE_DIR`.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
## Migration steps (recommended)
|
|
|
|
|
|
|
|
|
|
|
|
### Step 0 — Make a backup (old machine)
|
|
|
|
|
|
|
|
|
|
|
|
On the **old** machine, stop the gateway first so files aren’t changing mid-copy:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw gateway stop
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
(Optional but recommended) archive the state dir and workspace:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Adjust paths if you use a profile or custom locations
|
|
|
|
|
|
cd ~
|
2026-01-30 03:15:10 +01:00
|
|
|
|
tar -czf openclaw-state.tgz .openclaw
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
tar -czf openclaw-workspace.tgz .openclaw/workspace
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
If you have multiple profiles/state dirs (e.g. `~/.openclaw-main`, `~/.openclaw-work`), archive each.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
### Step 1 — Install OpenClaw on the new machine
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
On the **new** machine, install the CLI (and Node if needed):
|
|
|
|
|
|
|
|
|
|
|
|
- See: [Install](/install)
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
At this stage, it’s OK if onboarding creates a fresh `~/.openclaw/` — you will overwrite it in the next step.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
### Step 2 — Copy the state dir + workspace to the new machine
|
|
|
|
|
|
|
|
|
|
|
|
Copy **both**:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `$OPENCLAW_STATE_DIR` (default `~/.openclaw/`)
|
|
|
|
|
|
- your workspace (default `~/.openclaw/workspace/`)
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
Common approaches:
|
|
|
|
|
|
|
|
|
|
|
|
- `scp` the tarballs and extract
|
|
|
|
|
|
- `rsync -a` over SSH
|
|
|
|
|
|
- external drive
|
|
|
|
|
|
|
|
|
|
|
|
After copying, ensure:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- Hidden directories were included (e.g. `.openclaw/`)
|
2026-01-26 12:59:06 -08:00
|
|
|
|
- File ownership is correct for the user running the gateway
|
|
|
|
|
|
|
|
|
|
|
|
### Step 3 — Run Doctor (migrations + service repair)
|
|
|
|
|
|
|
|
|
|
|
|
On the **new** machine:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw doctor
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Doctor is the “safe boring” command. It repairs services, applies config migrations, and warns about mismatches.
|
|
|
|
|
|
|
|
|
|
|
|
Then:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw gateway restart
|
|
|
|
|
|
openclaw status
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Common footguns (and how to avoid them)
|
|
|
|
|
|
|
|
|
|
|
|
### Footgun: profile / state-dir mismatch
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
If you ran the old gateway with a profile (or `OPENCLAW_STATE_DIR`), and the new gateway uses a different one, you’ll see symptoms like:
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
- config changes not taking effect
|
|
|
|
|
|
- channels missing / logged out
|
|
|
|
|
|
- empty session history
|
|
|
|
|
|
|
|
|
|
|
|
Fix: run the gateway/service using the **same** profile/state dir you migrated, then rerun:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw doctor
|
2026-01-26 12:59:06 -08:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
### Footgun: copying only `openclaw.json`
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
`openclaw.json` is not enough. Many providers store state under:
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `$OPENCLAW_STATE_DIR/credentials/`
|
|
|
|
|
|
- `$OPENCLAW_STATE_DIR/agents/<agentId>/...`
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
Always migrate the entire `$OPENCLAW_STATE_DIR` folder.
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
### Footgun: permissions / ownership
|
|
|
|
|
|
|
|
|
|
|
|
If you copied as root or changed users, the gateway may fail to read credentials/sessions.
|
|
|
|
|
|
|
|
|
|
|
|
Fix: ensure the state dir + workspace are owned by the user running the gateway.
|
|
|
|
|
|
|
|
|
|
|
|
### Footgun: migrating between remote/local modes
|
|
|
|
|
|
|
|
|
|
|
|
- If your UI (WebUI/TUI) points at a **remote** gateway, the remote host owns the session store + workspace.
|
|
|
|
|
|
- Migrating your laptop won’t move the remote gateway’s state.
|
|
|
|
|
|
|
|
|
|
|
|
If you’re in remote mode, migrate the **gateway host**.
|
|
|
|
|
|
|
|
|
|
|
|
### Footgun: secrets in backups
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
`$OPENCLAW_STATE_DIR` contains secrets (API keys, OAuth tokens, WhatsApp creds). Treat backups like production secrets:
|
2026-01-26 12:59:06 -08:00
|
|
|
|
|
|
|
|
|
|
- store encrypted
|
|
|
|
|
|
- avoid sharing over insecure channels
|
|
|
|
|
|
- rotate keys if you suspect exposure
|
|
|
|
|
|
|
|
|
|
|
|
## Verification checklist
|
|
|
|
|
|
|
|
|
|
|
|
On the new machine, confirm:
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `openclaw status` shows the gateway running
|
2026-01-26 12:59:06 -08:00
|
|
|
|
- Your channels are still connected (e.g. WhatsApp doesn’t require re-pair)
|
|
|
|
|
|
- The dashboard opens and shows existing sessions
|
|
|
|
|
|
- Your workspace files (memory, configs) are present
|
|
|
|
|
|
|
|
|
|
|
|
## Related
|
|
|
|
|
|
|
|
|
|
|
|
- [Doctor](/gateway/doctor)
|
|
|
|
|
|
- [Gateway troubleshooting](/gateway/troubleshooting)
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- [Where does OpenClaw store its data?](/help/faq#where-does-openclaw-store-its-data)
|