乐于分享
好东西不私藏

OpenClaw 小龙虾安装配置教程

OpenClaw 小龙虾安装配置教程

最近超火的小龙虾大家应该都听说了,今天出一起安装教程,大家有问题可以留言交流,talk is cheap,show me the code。

 OpenClaw 是一个自托管的 AI 网关,可将 WhatsApp、Telegram、Discord、iMessage 等聊天应用连接到 AI 助手。


📋 前置要求

  • Node.js 22+ (必需)

  • Git (推荐安装)

  • 5 分钟时间

检查 Node 版本:

node --version

🍎 macOS 安装

方法一:一键安装脚本(推荐)

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

安装完成后运行向导:

openclaw onboard --install-daemon

方法二:macOS App(图形界面)

  1. 下载 OpenClaw.app

  2. 打开应用并完成权限设置

  3. 在菜单栏启动 Gateway

  4. 运行 openclaw channels login 绑定聊天渠道

验证安装

# 检查 Gateway 状态 
openclaw gateway status  
# 打开控制面板 
openclaw dashboard

🪟 Windows 安装

方法一:PowerShell 一键安装(推荐)

管理员身份打开 PowerShell,运行:

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

安装完成后运行向导:

openclaw onboard --install-daemon

方法二:手动安装

  1. 安装 Node.js 22+

  • 访问 https://nodejs.org 下载 LTS 版本

  • 或使用 winget: winget install OpenJS.NodeJS.LTS

  1. 安装 Git

  • 访问 https://gitforwindows.org

  1. 安装 OpenClaw

    npm install -g openclaw@latest
  2. 运行向导

    openclaw onboard

常见问题

“openclaw 不是可识别的命令”

# 查看 npm 全局路径 
npm config get prefix 
# 将该路径添加到用户 PATH 环境变量,重启 PowerShell

“npm error spawn git / ENOENT”

  • 安装 Git for Windows 后重试


🐧 Linux 安装

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

systemd 服务配置

Linux 使用 systemd 用户服务。如果 Gateway 在登出后停止:

sudo loginctl enable-linger $USER

⚙️ 初始配置

1. 运行向导

openclaw onboard --install-daemon

向导会帮你配置:

  • AI 模型提供商和 API Key

  • Gateway 设置

  • 可选的聊天渠道绑定

2. 配置文件位置

配置文件位于:~/.openclaw/openclaw.json

示例配置:

{  channels: {    whatsapp: {      allowFrom: ["+8613800000000"],  // 允许的用户      groups: { "*": { requireMention: true } },  // 群组需要 @ 才响应    },  },  messages: { groupChat: { mentionPatterns: ["@openclaw"] } },}

3. 绑定聊天渠道

# WhatsApp openclaw channels login  
# 查看已绑定的渠道 
openclaw channels list

4. 启动 Gateway

# 后台服务模式(推荐) 
openclaw gateway start  
# 前台调试模式 
openclaw gateway --port 18789

🌐 访问控制面板

本地访问

openclaw dashboard

或浏览器打开:http://127.0.0.1:18789/

远程访问

方式一:Tailscale(推荐)

openclaw gateway tailscale

方式二:配置反向代理

  • Nginx / Caddy 反向代理到 18789 端口

  • 配置 HTTPS 和认证


🔧 常用命令

# 查看状态 
openclaw status openclaw gateway status openclaw health  
# 服务管理 
openclaw gateway start openclaw gateway stop openclaw gateway restart  
# 消息测试 openclaw message send --target +8613800000000 --message "Hello"  
# 查看日志 openclaw logs --follow  
# 更新 openclaw update

📁 目录结构

~/.openclaw/├── openclaw.json          # 主配置文件├── workspace/             # 工作空间(技能、记忆、提示词)│   ├── SOUL.md           # 助手人格定义│   ├── USER.md           # 用户信息│   ├── MEMORY.md         # 长期记忆│   ├── memory/           # 日常记忆文件│   └── TOOLS.md          # 本地工具配置├── credentials/           # 渠道凭证├── agents/               # Agent 会话数据└── secrets.json          # 加密密钥(可选)

🛠️ 故障排查

Gateway 无法启动

# 查看详细日志 
openclaw logs --follow  
# 检查端口占用 
lsof -i :18789  # macOS/Linux 
netstat -ano | findstr 18789  # Windows

模型认证失败

# 重新登录模型提供商 
openclaw models auth login --provider qwen-portal

渠道连接问题

# 重新绑定渠道 
openclaw channels logout o
penclaw channels login

📚 更多资源

  • 官方文档:https://docs.openclaw.ai

  • 社区 Discord:https://discord.com/invite/clawd

  • 技能市场:https://clawhub.com

  • GitHub:https://github.com/openclaw/openclaw