OpenClaw 安装教程 - 打造你的个人 AI 助手
OpenClaw 是一个功能强大的个人 AI 助手平台,支持:✅ 多平台消息接入(WhatsApp、Telegram、Discord、飞书等)✅ 多种 AI 模型(OpenAI、Claude、Gemini 等)✅ 本地运行,数据隐私安全✅ 可扩展技能系统✅ 语音交互支持✅ 跨平台支持(Windows、macOS、Linux、iOS、Android)开始使用 OpenClaw,让 AI 成为你的私人
OpenClaw 安装教程 - 打造你的个人 AI 助手
OpenClaw 是一个开源的个人 AI 助手,可以在你自己的设备上运行,支持多平台消息接入(WhatsApp、Telegram、Discord、飞书等),让你随时随地与 AI 对话。
📋 目录
1. 环境要求
在安装 OpenClaw 之前,请确保你的系统满足以下要求:
| 操作系统 | 要求 |
|---|---|
| Windows | 推荐 WSL2(Windows Subsystem for Linux) |
| macOS | 原生支持 |
| Linux | 原生支持 |
运行时要求: Node.js ≥ 22
2. 安装 Node.js
Windows 用户
方法一:使用 WSL2(推荐)
- 打开 PowerShell(管理员),运行:
wsl --install
-
重启电脑后,WSL2 会自动安装 Ubuntu
-
进入 WSL2:
wsl
- 安装 Node.js 22:
# 使用 nvm 安装
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 22
nvm use 22
方法二:直接在 Windows 安装
- 下载 Node.js 官网 的 LTS 版本
- 运行安装程序,一路 Next 即可
- 打开 PowerShell 验证:
node --version # 应显示 v22.x.x
macOS 用户
# 使用 Homebrew 安装
brew install node@22
# 或使用 nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.zshrc
nvm install 22
nvm use 22
Linux 用户
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# 或使用 nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 22
nvm use 22
3. 安装 OpenClaw
安装好 Node.js 后,使用 npm 全局安装 OpenClaw:
npm install -g openclaw@latest
可选: 如果使用 pnpm 或 bun:
# pnpm
pnpm add -g openclaw@latest
# bun
bun add -g openclaw@latest
验证安装:
openclaw --version
4. 运行配置向导
OpenClaw 提供了交互式的配置向导,帮助你完成初始化设置:
openclaw onboard --install-daemon
向导会引导你完成以下步骤:
-
选择 AI 模型提供商
- OpenAI(推荐,支持 ChatGPT)
- Anthropic(Claude)
- Google(Gemini)
- 其他兼容 OpenAI API 的提供商
-
配置 API 密钥
- 输入你的 API Key
- 或使用 OAuth 登录(支持 OpenAI)
-
创建工作空间
- 设置工作目录
- 配置代理(可选)
-
安装 Gateway 守护进程
--install-daemon参数会自动配置系统服务- macOS:使用 launchd
- Linux:使用 systemd
- Windows:需要手动配置
5. 启动 Gateway
Gateway 是 OpenClaw 的核心控制平面,负责处理所有消息和请求。
手动启动
openclaw gateway --port 18789 --verbose
作为系统服务运行
配置向导已经安装了守护进程,Gateway 会自动启动。
管理服务:
# 查看状态
openclaw gateway status
# 启动服务
openclaw gateway start
# 停止服务
openclaw gateway stop
# 重启服务
openclaw gateway restart
6. 连接消息平台
OpenClaw 支持多种消息平台,你可以通过配置文件或 CLI 连接。
支持的平台
- Telegram
- Discord
- Slack
- 飞书(Feishu)
- Signal
- Microsoft Teams
- Matrix
- LINE
- 更多…
连接 Telegram
-
创建 Telegram Bot:
- 在 Telegram 中搜索
@BotFather - 发送
/newbot创建新机器人 - 保存 Bot Token
- 在 Telegram 中搜索
-
配置 OpenClaw:
openclaw config set channels.telegram.botToken "your-bot-token"
连接 Discord
-
创建 Discord Bot:
- 访问 Discord Developer Portal
- 创建新应用,添加 Bot
- 获取 Token,开启必要的 Intents
-
邀请 Bot 加入服务器:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=8
- 配置 OpenClaw:
openclaw config set channels.discord.token "your-bot-token"
连接飞书
-
创建飞书应用:
- 访问 飞书开放平台
- 创建企业自建应用
- 获取 App ID 和 App Secret
-
配置权限和事件订阅
-
配置 OpenClaw:
openclaw config set channels.feishu.appId "your-app-id"
openclaw config set channels.feishu.appSecret "your-app-secret"
7. 开始使用
通过 CLI 对话
# 直接与 AI 对话
openclaw agent --message "帮我写一个 Python 脚本"
# 启用深度思考模式
openclaw agent --message "分析这段代码的优化空间" --thinking high
发送消息
# 发送消息到指定渠道
openclaw message send --to +1234567890 --message "Hello from OpenClaw"
访问 WebChat
Gateway 启动后,可以通过浏览器访问:
http://localhost:18789
使用 macOS/Windows 应用
- macOS:下载菜单栏应用,支持语音唤醒、Canvas 等
- iOS/Android:使用节点应用,支持移动端控制
8. 常见问题
Q: 如何更新 OpenClaw?
npm update -g openclaw@latest
openclaw doctor # 检查配置
Q: 如何查看日志?
openclaw logs
Q: Gateway 启动失败怎么办?
- 检查端口是否被占用:
# Linux/macOS
lsof -i :18789
# Windows
netstat -ano | findstr :18789
- 运行诊断:
openclaw doctor
Q: 如何配置代理?
openclaw config set proxy "http://127.0.0.1:7890"
Q: 安全性如何?
- 默认启用 DM 配对机制,陌生人需先配对才能对话
- 使用
openclaw doctor检查安全配置 - 所有数据本地存储,不上传云端
📚 更多资源
- 官方文档:https://docs.openclaw.ai
- GitHub:https://github.com/openclaw/openclaw
- Discord 社区:https://discord.gg/clawd
- 技能商店:https://clawhub.com
总结
OpenClaw 是一个功能强大的个人 AI 助手平台,支持:
✅ 多平台消息接入(WhatsApp、Telegram、Discord、飞书等)
✅ 多种 AI 模型(OpenAI、Claude、Gemini 等)
✅ 本地运行,数据隐私安全
✅ 可扩展技能系统
✅ 语音交互支持
✅ 跨平台支持(Windows、macOS、Linux、iOS、Android)
开始使用 OpenClaw,让 AI 成为你的私人助手!
如果这篇文章对你有帮助,欢迎点赞收藏关注 ~ 🙏
更多推荐



所有评论(0)