
养虾日记:如何安全彻底卸载 OpenClaw 零残留
为什么要彻底卸载?
OpenClaw 安装后会在系统多个位置留下文件。简单 npm uninstall -g openclaw 并不够——可能残留配置文件、缓存、API 密钥。
完整卸载步骤
1. 停止运行中的进程
# 查找所有 OpenClaw 进程
ps aux | grep openclaw
# 终止
pkill -f openclaw
2. 卸载主程序
npm uninstall -g openclaw
3. 清理配置文件
# 主配置目录
rm -rf ~/.openclaw
rm -rf ~/.config/openclaw
# VS Code 扩展配置
rm -rf ~/.vscode/extensions/openclaw*
4. 清理缓存
# npm 缓存中的 OpenClaw 包
npm cache ls | grep openclaw | xargs npm cache rm
# 模型缓存
rm -rf ~/.cache/openclaw
5. 撤销 API 密钥
最关键的一步! 去 API 提供商控制台:
- 撤销当前使用的 API Key
- 生成新的 API Key 用于其他项目
- 检查 API 用量是否有异常消费
6. 检查 systemd / launchd
# Linux
systemctl disable openclaw 2>/dev/null
rm -f /etc/systemd/system/openclaw.service
# macOS
launchctl unload ~/Library/LaunchAgents/com.openclaw.* 2>/dev/null
rm -f ~/Library/LaunchAgents/com.openclaw.*
7. 验证卸载
which openclaw # 应该无输出
find / -name "openclaw" -type d 2>/dev/null # 搜索残留
安全检查清单
- 进程已终止
- 主程序已卸载
- 配置文件已删除
- 缓存已清理
- API 密钥已撤销
- 系统服务已移除
- 无残留文件
来源: @vivimoneya 的安全指南