Skip to content

快速入门

目标:从零开始,尽快跑起来第一个可用的 AI 聊天。

提示:最快体验路径是打开 Control UI(无需配置任何渠道)。运行 openclaw dashboard 直接在浏览器里聊天,或访问 http://127.0.0.1:18789/


前置条件

  • Node.js 22 或更新版本(检查:node --version
  • macOS / Linux,或通过 WSL2 的 Windows(强烈推荐 WSL2,原生 Windows 工具兼容性差)

提示:不确定 Node 版本或遇到安装问题,参考 Node.js 安装


步骤 1:安装 CLI

macOS / Linux

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

Windows(PowerShell)

powershell
iwr -useb https://openclaw.ai/install.ps1 | iex

通过 npm / pnpm 手动安装

bash
npm install -g openclaw@latest
# 或
pnpm add -g openclaw@latest

注意:其他安装方式(Docker、Nix、Ansible)请参考 安装总览


步骤 2:运行新手引导向导

bash
openclaw onboard --install-daemon

向导会引导你完成以下配置:

  • 模型认证:推荐 OAuth;Anthropic 用户推荐直接填 API Key(claude setup-token 也支持)
  • Gateway 设置:本地 vs 远程
  • 渠道接入:WhatsApp QR 扫码、Telegram/Discord Bot Token 等(可跳过,稍后配置)
  • 后台守护进程:安装 launchd(macOS)/ systemd(Linux)

Bun 警告:如果你使用 WhatsApp 或 Telegram,Gateway 必须用 Node 运行,Bun 与这两个渠道有已知兼容问题。


步骤 3:确认 Gateway 运行

如果向导中安装了守护进程,此时 Gateway 应已自动启动:

bash
openclaw gateway status

如需手动在前台运行(方便调试):

bash
openclaw gateway --port 18789 --verbose

步骤 4:快速健康检查

bash
openclaw status
openclaw health

如果 openclaw health 提示「未配置认证」,需要回到向导重新设置 OAuth / API Key,否则 Agent 不会响应消息。


步骤 5:打开 Control UI

bash
openclaw dashboard

浏览器打开 http://127.0.0.1:18789/,Control UI 加载成功即代表 Gateway 正常运行。


步骤 6:连接第一个聊天渠道

WhatsApp(扫码登录)

bash
openclaw channels login

打开 WhatsApp → 设置 → 链接设备,扫描终端里的二维码。

Telegram / Discord

向导可以直接写入 Bot Token。如果跳过了向导,手动配置参考对应渠道文档。

Telegram 提示:第一条私信会返回配对码,需要批准后 Bot 才会响应。


步骤 7:配对审批(私信安全)

默认情况下,陌生私信先返回短代码,消息暂不处理,需手动批准:

bash
openclaw pairing list whatsapp
openclaw pairing approve whatsapp <code>

步骤 8:发送测试消息

bash
openclaw message send --target +15555550123 --message "Hello from OpenClaw"

调试技巧openclaw status --all 是最全面的只读调试报告,遇到问题先运行这个。


常用环境变量

以服务账户运行或自定义路径时:

变量说明
OPENCLAW_HOME内部路径解析的 home 目录
OPENCLAW_STATE_DIR状态目录(覆盖默认)
OPENCLAW_CONFIG_PATH配置文件路径(覆盖默认)

完成后你将拥有

  • 一个运行中的 Gateway
  • 已配置的认证(OAuth 或 API Key)
  • Control UI 访问入口,或至少一个已连接的渠道

下一步