OpenClaw 常用命令手册
·
🦞 OpenClaw 常用命令手册(macOS 版)
适用于 OpenClaw 2026.x + LaunchAgent 模式
默认端口:18789
本地地址:http://127.0.0.1:18789
一、基础运行命令
1️⃣ 启动 Gateway(后台运行)
openclaw gateway start
或(已安装 LaunchAgent 时常用):
openclaw gateway
2️⃣ 停止 Gateway
openclaw gateway stop
示例输出:
Stopped LaunchAgent: gui/502/ai.openclaw.gateway
含义:已成功关闭后台服务。
3️⃣ 重启 Gateway(最常用)
openclaw gateway restart
适用于:
- 修改配置文件
- 修改 API key
- 切换模型
- 启用/禁用插件
4️⃣ 查看运行状态
openclaw status
重点关注:
- Gateway reachable / unreachable
- Default model
- Port 18789
- Sessions
二、聊天方式
1️⃣ 打开 Web 控制面板
openclaw dashboard
默认地址:
http://127.0.0.1:18789
2️⃣ 使用终端聊天(推荐调试)
openclaw tui
三、模型管理
查看已配置模型
openclaw models list
查看模型状态
openclaw models status
设置默认模型
openclaw models set <provider/model>
例如:
openclaw models set deepseek/deepseek-chat
四、日志与排查
实时查看日志
openclaw logs --follow
查看 Gateway 原始日志
tail -f ~/.openclaw/logs/gateway.log
检查端口是否监听
lsof -nP -iTCP:18789 -sTCP:LISTEN
运行健康检查
openclaw doctor
更详细:
openclaw doctor --deep
五、插件管理
禁用 memory 插件
openclaw plugins disable memory-core
启用插件
openclaw plugins enable <plugin-name>
六、环境变量管理(重要)
设置 DeepSeek API Key(当前终端有效)
export DEEPSEEK_API_KEY="sk-xxxx"
让 LaunchAgent 也能读取 Key(推荐方式)
launchctl setenv DEEPSEEK_API_KEY "sk-xxxx"
七、常见问题排查顺序
当出现以下情况时:
- gateway not connected
- ECONNREFUSED
- 模型无响应
按顺序排查:
openclaw status
lsof -nP -iTCP:18789 -sTCP:LISTEN
openclaw logs --follow
openclaw doctor --deep
八、推荐日常使用流程
开始工作
openclaw gateway start
openclaw dashboard
或:
openclaw tui
修改配置后
openclaw gateway restart
结束工作
openclaw gateway stop
九、重要提醒
❌ 不要反复执行:
openclaw gateway
openclaw gateway
openclaw gateway
会导致端口冲突或状态混乱。
十、推荐稳定方案
- 安装系统 Node 22+
- 使用 LaunchAgent 模式
- API key 使用
launchctl setenv注入 - 配置修改后统一使用
gateway restart - 定期更新版本:
openclaw update
文档版本:OpenClaw 2026.x(macOS)
更多推荐




所有评论(0)