如何在 MacOS 上部署 OpenClaw
OpenClaw 是一个强大的 AI 助手框架,可以让你在本地运行各种 AI Agent。今天来分享一下如何在 MacOS 上快速部署它。
前置要求
- macOS 系统(建议 Monterey 及以上)
- Homebrew(包管理器)
- Node.js 22+(可选,安装脚本会自动检测)
安装步骤
1. 安装 Homebrew(如果还没有)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. 一键安装 OpenClaw
最简单的方式,使用官方安装脚本:
curl -fsSL https://openclaw.ai/install.sh | bash
提示: 安装脚本会自动检测 Node.js,如果没有会帮你安装。
3. 初始化配置
安装完成后,运行配置向导:
openclaw configure
说明: 配置过程会引导你设置 API Key、通讯渠道、Gateway 端口等。
4. 启动 Gateway
openclaw gateway start
5. 验证安装
openclaw doctor
openclaw status
常用命令
openclaw dashboard | 打开浏览器控制台 |
openclaw gateway start | 启动 Gateway |
openclaw gateway stop | 停止 Gateway |
openclaw gateway restart | 重启 Gateway |
openclaw doctor | 健康检查 |
常见问题
问题: 安装后命令找不到?
解决: 需要将 npm 全局路径添加到 PATH:
然后添加到 ~/.zshrc 文件中。
解决: 需要将 npm 全局路径添加到 PATH:
export PATH="$(npm prefix -g)/bin:$PATH"然后添加到 ~/.zshrc 文件中。
问题: sharp 构建失败?
解决: 如果你用 Homebrew 安装了 libvips,运行:
解决: 如果你用 Homebrew 安装了 libvips,运行:
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
卸载
openclaw uninstall
感谢阅读