安装指南
按照以下步骤轻松安装 OpenClaw,开启您的AI助手之旅
使用 npm 全局安装(推荐)
前提条件
确保已安装 Node.js ≥22.0.0
# 检查 Node.js 版本
node --version
安装 OpenClaw
# 使用 npm 安装
npm install -g openclaw@latest
# 或使用 pnpm 安装
pnpm add -g openclaw@latest
验证安装
# 检查版本
openclaw --version
# 运行诊断
openclaw doctor
快速开始
# 运行配置向导
openclaw onboard --install-daemon
# 启动 Gateway
openclaw gateway --port 18789 --verbose
使用安装脚本
下载并运行安装脚本
curl -fsSL https://get.openclaw.ai/install.sh | sh
验证安装
# 检查版本
openclaw --version
# 运行诊断
openclaw doctor
快速开始
# 运行配置向导
openclaw onboard --install-daemon
# 启动 Gateway
openclaw gateway --port 18789 --verbose
从源码安装
克隆仓库
git clone https://github.com/openclaw/openclaw.git
cd openclaw
安装依赖并构建
# 安装依赖
pnpm install
# 构建项目
pnpm build
安装并启动
# 安装守护进程
pnpm openclaw onboard --install-daemon
# 启动 Gateway
openclaw gateway --port 18789 --verbose
验证安装
# 检查版本
openclaw --version
# 运行诊断
openclaw doctor
快速开始
1
运行配置向导
首次使用,运行配置向导完成基本设置
openclaw onboard --install-daemon
向导会引导您完成:
- Gateway 配置
- 工作空间设置
- 通道配置
- 模型认证
- 技能安装
2
启动 Gateway
启动 OpenClaw 网关服务
openclaw gateway --port 18789 --verbose
3
发送测试消息
测试消息发送功能
openclaw message send --to +1234567890 --message "Hello from OpenClaw"
4
与助手交互
开始使用 AI 助手
openclaw agent --message "帮我创建一个待办事项列表" --thinking high
系统要求
最低要求
- Node.js: ≥22.0.0
- 操作系统: macOS 12.0+ / Linux (主流发行版) / Windows 10+ (通过WSL2)
- 内存: 最低4GB
- 磁盘空间: 最低500MB
- 网络: 互联网连接(用于下载技能和更新)
推荐配置
- Node.js: 最新LTS版本
- 内存: 16GB+
- 磁盘空间: 2GB+
- 网络: 高速互联网连接
平台特定要求
macOS
- macOS 12.0 (Monterey) 或更高版本
- Xcode Command Line Tools(用于某些功能)
Linux
- systemd(用于守护进程)
- Docker(可选,用于沙箱)
Windows
- WSL2(强烈推荐)
- Windows Terminal
常见问题
Gateway 无法启动怎么办?
检查端口占用和日志信息:
# 检查端口占用
lsof -i :18789
# 查看日志
openclaw logs
# 运行诊断
openclaw doctor
通道连接失败怎么办?
检查认证配置和连接状态:
# 检查认证配置
openclaw config show
# 测试通道连接
openclaw channels test telegram
# 查看通道状态
openclaw channels status
模型调用失败怎么办?
检查 API 密钥和模型配置:
# 检查 API 密钥
openclaw secrets show
# 测试模型连接
openclaw models test openai:gpt-4o
# 查看模型配置
openclaw models list
如何更新到最新版本?
使用更新命令检查并更新:
# 检查更新
openclaw update --check
# 执行更新
openclaw update
# 切换更新通道
openclaw update --channel stable|beta|dev
如何查看日志?
使用日志命令查看实时日志:
# 实时日志
openclaw logs --follow
# 特定组件日志
openclaw logs --component gateway
openclaw logs --component agent
# 调试模式
openclaw gateway --verbose
如何重置配置?
谨慎使用重置命令:
# 重置特定配置
openclaw config reset channels
# 完全重置(谨慎使用)
openclaw reset --all