运行官方卸载命令
openclaw uninstall(删除工作目录和数据)
移除CLI包
npm rm -g openclaw(或pnpm/bun对应命令)
常见错误 :仅运行npm uninstall -g openclaw会导致以下残留:
~/.openclaw/ 中的 敏感数据 (API密钥、凭证)openclaw uninstall命令(CLI已删除)必须立即撤销的访问权限
两种卸载路径
路径A:推荐(CLI仍可用)
自动化卸载(最快)
openclaw uninstall --all --yes --non-interactive交互式卸载
openclaw uninstall然后:
手动分步卸载(相同效果)
# 1. 停止网关服务openclaw gateway stop# 2. 卸载网关服务本身openclaw gateway uninstall# 3. 删除状态和配置(核心步骤!)rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"# 4. 可选:删除工作区rm -rf ~/.openclaw/workspace# 5. 移除CLI包npm rm -g openclaw# 或 pnpm remove -g openclaw# 或 bun remove -g openclaw# 6. macOS特有:删除应用rm -rf /Applications/OpenClaw.app
路径B:手动清理(CLI已缺失但服务仍在运行)
macOS (LaunchAgent)
服务标签名称 :由于OpenClaw经历了 快速改名历史 ,服务标签可能不同:
bot.molt.gateway | ~/Library/LaunchAgents/bot.molt.gateway.plist | |
com.openclaw.* | ~/Library/LaunchAgents/com.openclaw.*.plist | |
ai.openclaw.gateway | ~/Library/LaunchAgents/ai.openclaw.gateway.plist |
全面卸载命令 (执行所有可能):
# 停止并删除所有可能的服务launchctl bootout gui/$UID/ai.openclaw.gateway 2>/dev/null ||truelaunchctl bootout gui/$UID/bot.molt.gateway 2>/dev/null ||true# 删除所有可能的plist文件rm -f ~/Library/LaunchAgents/ai.openclaw.gateway.plistrm -f ~/Library/LaunchAgents/bot.molt.gateway.plistrm -f ~/Library/LaunchAgents/com.openclaw*.plist
Linux(systemd用户服务)
# 停止并删除服务systemctl --user disable --now openclaw-gateway.servicerm -f ~/.config/systemd/user/openclaw-gateway.servicesystemctl --user daemon-reload# 如果使用配置文件systemctl --user disable --now "openclaw-gateway-<profile>.service"rm -f ~/.config/systemd/user/openclaw-gateway-<profile>.service
Windows (计划任务)
以管理员身份 打开PowerShell:
# 1. 停止并删除网关服务openclaw gateway stop# 或直接删除计划任务schtasks /Delete /F /TN "OpenClaw Gateway"# 2. 删除关联脚本Remove-Item -Force "$env:USERPROFILE\.openclaw\gateway.cmd"# 3. 如果使用配置文件(--profile)schtasks /Delete /F /TN "OpenClaw Gateway (<profile名>)"Remove-Item -Force "$env:USERPROFILE\.openclaw-<profile名>\gateway.cmd"
关键步骤:清理历史残留目录
由于OpenClaw在2026年1月底经历了 两次改名 : Clawdbot → Moltbot → OpenClaw ,如果你在不同时期安装过,系统可能同时存在 四套配置目录 :
必须删除的目录清单
# 当前版本rm -rf ~/.openclaw# 历史版本残留(巨坑!很多人忘记这一步)rm -rf ~/.clawdbotrm -rf ~/.moltbotrm -rf ~/.molthub# 技能缓存目录# 临时文件rm -rf /tmp/openclaw# macOS/Linux
Windows PowerShell命令
Remove-Item -Recurse -Force "$env:USERPROFILE\.openclaw"Remove-Item -Recurse -Force "$env:USERPROFILE\.clawdbot"Remove-Item -Recurse -Force "$env:USERPROFILE\.moltbot"Remove-Item -Recurse -Force "$env:APPDATA\OpenClaw"
Docker安装的卸载
# 停止并删除容器docker compose down --volumes --remove-orphans# 删除镜像docker rmi openclaw/openclaw:latest# 清理未使用的卷docker volume prune -f
验证卸载是否成功
检查CLI是否已移除
openclaw --version# ✅ 期望输出:"command not found" 或类似错误
检查配置目录是否已删除
ls ~/.openclaw ~/.clawdbot ~/.moltbot ~/.molthub 2>&1# ✅ 期望输出:"No such file or directory"
检查服务是否仍在运行
macOS/Linux :
launchctl list | grep -i openclawsystemctl --user status openclaw-gateway.serviceps aux | grep openclaw# ✅ 期望:无任何输出
Windows :
schtasks /Query /TN "OpenClaw Gateway"# ✅ 期望:"错误: 系统找不到指定的文件。"
快速卸载流程
开始卸载 ↓
【步骤1】检查CLI是否可用├─ 可用 → 运行 openclaw uninstall --all --yes --non-interactive └─ 不可用 → 手动停止并删除后台服务(见平台特定步骤)↓【步骤2】删除状态和配置目录rm -rf ~/.openclaw (以及 ~/.clawdbot, ~/.moltbot, ~/.molthub)↓【步骤3】移除CLI包npm rm -g openclaw / pnpm remove -g openclaw / bun remove -g openclaw↓【步骤4】平台特定清理├─ macOS: rm -rf /Applications/OpenClaw.app├─ Windows: 删除计划任务和gateway.cmd└─ Docker: docker compose down + docker rmi↓【步骤5】验证├─ openclaw --version → 应报错├─ ls ~/.openclaw → 应不存在└─ 检查服务状态 → 应无残留 ↓卸载完成
夜雨聆风