OpenClaw macOS 完整安装与本地模型配置教程(实战版)
说实话这玩意在 Mac 上装起来真的比 Windows 顺太多了,一条 curl 命令直接梭,Homebrew、Node 都给你检测好,基本不用手动处理什么。这篇就是我边装边记录的实战文档,包含真实日志和所有踩坑点,用过的就算了。

作者:吴佳浩
撰稿时间:2026-3-8
测试模型:qwen3.5:9b(ollama 量化版,Mac 内存小就跑小模型,你们随意)
OpenClaw(前身为 ClawdBot / Moltbot)是一款开源的本地自托管 AI 个人智能助手平台,支持接入 Claude、GPT、Qwen、DeepSeek、Ollama 本地模型等,可实现文件操作、终端执行、浏览器控制、定时任务等全场景自动化。
本文基于 **MacBook Pro M1Pro+ macOS Sequoia(15.3.2 )真实环境实战整理,包含所有踩坑记录与解决方案。
目录
- 系统要求
- 整体流程概览
- [Step 1:安装 Node.js(≥ 22)](#Step 1:安装 Node.js(≥ 22) "#3-step-1%E5%AE%89%E8%A3%85-nodejs--22")
- [Step 2:安装 OpenClaw(一键脚本)](#Step 2:安装 OpenClaw(一键脚本) "#4-step-2%E5%AE%89%E8%A3%85-openclaw%E4%B8%80%E9%94%AE%E8%84%9A%E6%9C%AC")
- [Step 3:运行初始化向导(完整实战)](#Step 3:运行初始化向导(完整实战) "#5-step-3%E8%BF%90%E8%A1%8C%E5%88%9D%E5%A7%8B%E5%8C%96%E5%90%91%E5%AF%BC%E5%AE%8C%E6%95%B4%E5%AE%9E%E6%88%98")
- [Step 4:安装 Ollama(本地模型运行环境)](#Step 4:安装 Ollama(本地模型运行环境) "#6-step-4%E5%AE%89%E8%A3%85-ollama%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83")
- [Step 5:下载本地模型](#Step 5:下载本地模型 "#7-step-5%E4%B8%8B%E8%BD%BD%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B")
- [Step 6:启动 Gateway 与打开 Dashboard](#Step 6:启动 Gateway 与打开 Dashboard "#8-step-6%E5%90%AF%E5%8A%A8-gateway-%E4%B8%8E%E6%89%93%E5%BC%80-dashboard")
- [Step 7:处理 Skills 安装失败(Xcode 版本问题)](#Step 7:处理 Skills 安装失败(Xcode 版本问题) "#9-step-7%E5%A4%84%E7%90%86-skills-%E5%AE%89%E8%A3%85%E5%A4%B1%E8%B4%A5xcode-%E7%89%88%E6%9C%AC%E9%97%AE%E9%A2%98")
- 常用命令速查
- [常见问题 FAQ(实战踩坑)](#常见问题 FAQ(实战踩坑) "#11-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98-faq%E5%AE%9E%E6%88%98%E8%B8%A9%E5%9D%91")
- [模型推荐选型(Apple Silicon)](#模型推荐选型(Apple Silicon) "#12-%E6%A8%A1%E5%9E%8B%E6%8E%A8%E8%8D%90%E9%80%89%E5%9E%8Bapple-silicon")
- [openclaw.json 完整配置参考](#openclaw.json 完整配置参考 "#13-openclawijson-%E5%AE%8C%E6%95%B4%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83")
1. 系统要求
| 项目 | 最低要求 | 推荐配置 |
|---|---|---|
| 操作系统 | macOS 12 Monterey | macOS 14 Sonoma+ |
| Node.js | ≥ 22.0 | 最新 LTS |
| 内存 | 8 GB RAM | 16 GB RAM+(统一内存兼做显存) |
| 芯片 | Intel / Apple Silicon | Apple Silicon(M 系列推荐) |
| 磁盘空间 | 10 GB 可用 | 50 GB+ |
| Homebrew | 需要安装 | --- |
| 网络 | 安装时需联网 | --- |
注意:Apple Silicon Mac 的统一内存(Unified Memory)同时作为 GPU 显存使用,跑本地模型效率很高,8B 以下模型体验极佳。
2. 整体流程概览
nvm use 24"] B --> C["一键安装 OpenClaw
curl -fsSL openclaw.ai/install.sh | bash"] C --> D["运行初始化向导
自动触发 openclaw onboard"] D --> E["选择 Custom Provider
接入 Ollama 本地模型"] E --> F["安装 Ollama
下载目标模型"] F --> G["LaunchAgent 自动启动
无需手动 gateway"] G --> H["openclaw dashboard
打开 Web UI"] H --> I["✅ 本地 AI 助手就绪"] style A fill:#1a1a2e,color:#fff style I fill:#00aa55,color:#fff
3. Step 1:安装 Node.js(≥ 22)
macOS 推荐使用 nvm(Node Version Manager)管理 Node 版本,方便随时切换。
方法一:nvm(推荐)
bash
# 安装 nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 重启终端或 source 配置文件
source ~/.zshrc
# 安装并使用 Node 24(≥ 22 即可)
nvm install 24
nvm use 24
实战日志:
bash
wujiahao@wujiahaoMacBook-Pro ~ % nvm use 24
Now using node v24.7.0 (npm v11.5.1)
方法二:Homebrew
bash
brew install node
验证
bash
node --version # v24.7.0
npm --version # 11.5.1
4. Step 2:安装 OpenClaw(一键脚本)
macOS 只需一条命令,安装脚本会自动检测 Homebrew、Node.js 版本并完成安装:
bash
curl -fsSL https://openclaw.ai/install.sh | bash
真实安装日志
bash
wujiahao@wujiahaoMacBook-Pro ~ % curl -fsSL https://openclaw.ai/install.sh | bash
🦞 OpenClaw Installer
I don't just autocomplete---I auto-commit (emotionally), then ask you to review (logically).
✓ Detected: macos
Install plan
OS: macos
Install method: npm
Requested version: latest
[1/3] Preparing environment
✓ Homebrew already installed
✓ Node.js v24.7.0 found
· Active Node.js: v24.7.0 (/Users/wujiahao/.nvm/versions/node/v24.7.0/bin/node)
· Active npm: 11.5.1 (/Users/wujiahao/.nvm/versions/node/v24.7.0/bin/npm)
[2/3] Installing OpenClaw
✓ Git already installed
· Installing OpenClaw v2026.3.2
✓ OpenClaw npm package installed
✓ OpenClaw installed
[3/3] Finalizing setup
🦞 OpenClaw installed successfully (2026.3.2)!
cracks claws Alright, what are we building?
实战说明 :安装完成后脚本会自动检测是否存在旧配置文件,如有会跑一次
doctor迁移设置,随后直接进入 onboarding 向导。
5. Step 3:运行初始化向导(完整实战)
安装脚本结束后会自动进入 初始化向导(等同于手动运行 openclaw onboard)。以下是完整的每一步操作说明。
向导每一步怎么选
→ 输入 Yes 继续"] B --> C["Onboarding mode
→ QuickStart"] C --> D["Config handling(如有旧配置)
→ Use existing values"] D --> E["Model/auth provider
→ Custom Provider
不要选内置 Ollama 选项"] E --> F["API Base URL
→ http://127.0.0.1:11434/v1"] F --> G["How to provide API key
→ Paste API key now"] G --> H["API Key
→ ollama(随便填,本地不验证)"] H --> I["Endpoint compatibility
→ OpenAI-compatible"] I --> J["Model ID
→ 填你已 pull 的模型
如 qwen3.5:9b"] J --> K["✅ Verification successful"] K --> L["Endpoint ID
→ 直接回车用默认"] L --> M["Model alias
→ 随意,如 qwen3.5-9b"] M --> N["Select channel
→ Skip for now"] N --> O["Configure skills now?
→ Yes"] O --> P["Install missing skill dependencies
→ 勾选需要的(见下表)"] P --> Q["API Keys
→ 全部 No(本地不需要)"] Q --> R["Enable hooks
→ 勾选 bootstrap-extra-files + command-logger"] R --> S["How to hatch
→ Open the Web UI"] S --> T["✅ 向导完成,浏览器自动打开"] style K fill:#00aa55,color:#fff style T fill:#00aa55,color:#fff style E fill:#c62828,color:#fff
向导关键节点实战日志
安全警告确认(必须选 Yes 才能继续):
bash
◇ I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?
│ Yes
选择 Custom Provider(不要选内置 Ollama,行为不一致):
bash
◇ Model/auth provider
│ Custom Provider
◇ API Base URL
│ http://127.0.0.1:11434/v1
◇ API Key (leave blank if not required)
│ ollama
◇ Endpoint compatibility
│ OpenAI-compatible
◇ Model ID
│ qwen3.5:9b
◇ Verification successful.
◇ Endpoint ID
│ custom-127-0-0-1-11434
◇ Model alias (optional)
│ qwen3.5-9b
Configured custom provider: custom-127-0-0-1-11434/qwen3.5:9b
跳过 Channel 配置:
bash
◇ Select channel (QuickStart)
│ Skip for now
Skills 推荐勾选清单
| Skill | macOS 可用 | 说明 |
|---|---|---|
clawhub |
✅ | 技能商店,必装 |
nano-pdf |
✅ | PDF 阅读分析 |
github |
✅ | GitHub 操作 |
bear-notes |
✅ | Bear 笔记集成 |
things-mac |
✅ | Things 3 任务管理 |
openai-whisper |
✅ | 本地语音识别 |
apple-notes |
⚠️ Xcode 过旧会失败 | Apple 备忘录 |
camsnap |
⚠️ Xcode 过旧会失败 | 摄像头截图 |
summarize |
⚠️ Xcode 过旧会失败 | 网页/文档总结 |
实战说明 :如果你的 Xcode 版本低于 16.4,大量依赖 Homebrew 编译的 Skills 会安装失败,这是正常现象,见 [Step 7](#Step 7 "#9-step-7%E5%A4%84%E7%90%86-skills-%E5%AE%89%E8%A3%85%E5%A4%B1%E8%B4%A5xcode-%E7%89%88%E6%9C%AC%E9%97%AE%E9%A2%98") 处理方案。
API Key 全部跳过
向导会依次询问以下 Key,全部选 No:
bash
◇ Set GOOGLE_PLACES_API_KEY for goplaces? → No
◇ Set GEMINI_API_KEY for nano-banana-pro? → No
◇ Set NOTION_API_KEY for notion? → No
◇ Set OPENAI_API_KEY for openai-image-gen? → No
◇ Set OPENAI_API_KEY for openai-whisper-api? → No
◇ Set ELEVENLABS_API_KEY for sag? → No
Hooks 启用
bash
◇ Enable hooks?
│ 📎 bootstrap-extra-files, 📝 command-logger
◇ Hooks Configured
│ Enabled 2 hooks: bootstrap-extra-files, command-logger
macOS 专属:LaunchAgent 自动安装
macOS 版会自动将 Gateway 注册为 LaunchAgent ,开机自启,无需手动每次运行 openclaw gateway:
bash
◒ Installing Gateway service....
Installed LaunchAgent: /Users/wujiahao/Library/LaunchAgents/ai.openclaw.gateway.plist
Logs: /Users/wujiahao/.openclaw/logs/gateway.log
◇ Gateway service installed.
Windows 与 macOS 区别 :Windows 需要手动运行
openclaw gateway,macOS 则由 LaunchAgent 自动管理,重启后不需要任何操作。
6. Step 4:安装 Ollama(本地模型运行环境)
方法一:官网下载(推荐)
- 访问 ollama.com
- 点击 Download for Mac ,下载
Ollama.dmg - 拖入应用程序,启动后菜单栏出现 🦙 图标
方法二:Homebrew
bash
brew install ollama
ollama serve # 前台运行,或用 brew services start ollama 后台运行
验证
bash
ollama --version
# ollama version 0.x.x ✓
curl http://localhost:11434
# Ollama is running ✓
7. Step 5:下载本地模型
按统一内存选择模型(Apple Silicon)
~2GB
入门可用"] B -- "16 GB" --> D["qwen2.5:7b / qwen3.5:9b
~5-6GB
均衡推荐 ⭐"] B -- "24 GB" --> E["qwen2.5:14b
~10GB
效果更好"] B -- "32 GB" --> F["qwen2.5:32b
~20GB
旗舰体验"] B -- "64 GB+" --> G["deepseek-r1:32b
~20GB
强推理首选"] style D fill:#2d6a4f,color:#fff style G fill:#7b2d8b,color:#fff
下载命令
bash
# 本文测试使用(16GB 内存推荐)
ollama pull qwen3.5:9b
# 其他选项
ollama pull qwen2.5:3b # 8GB 内存入门
ollama pull qwen2.5:7b # 通用均衡
ollama pull qwen2.5:14b # 24GB 内存
ollama pull deepseek-r1:32b # 强推理
ollama pull qwen2.5-coder:14b # 代码专用
# 查看已下载模型
ollama list
8. Step 6:启动 Gateway 与打开 Dashboard
macOS 的优势:LaunchAgent 自动管理
macOS 安装完成后 Gateway 已作为 LaunchAgent 注册,通常不需要手动启动。如需手动操作:
bash
# 查看服务状态
launchctl list | grep openclaw
# 手动启动(如果没有自动起来)
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
# 查看日志
tail -f ~/.openclaw/logs/gateway.log
正常运行的日志特征
bash
[gateway] agent model: custom-127-0-0-1-11434/qwen3.5:9b
[gateway] listening on ws://127.0.0.1:18789
[browser/server] Browser control listening on http://127.0.0.1:18791/
[hooks] loaded 4 internal hook handlers
打开 Dashboard(三种方式)
方式一:命令自动打开(推荐,自动带 token)
bash
openclaw dashboard
方式二:向导完成时的带 token 链接
向导结束时终端会展示:
bash
Dashboard link (with token):
http://127.0.0.1:18789/#token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Opened in your browser. Keep that tab to control OpenClaw.
方式三:查看当前 token 并手动拼 URL
bash
# 查看 token
openclaw config get gateway.auth.token
# 手动拼接
open "http://127.0.0.1:18789/#token=$(openclaw config get gateway.auth.token)"
关于 Token 认证
OpenClaw 默认开启 token 认证,防止局域网内其他设备控制你的电脑(它有文件读写、终端执行等高权限)。本机自用可以关闭:
bash
openclaw config set gateway.auth.mode none
关闭后直接访问 http://127.0.0.1:18789 无需 token。
9. Step 7:处理 Skills 安装失败(Xcode 版本问题)
macOS 上 Skills 安装失败的主要原因是 Xcode 版本过旧,而非像 Windows 那样缺少 brew。
实战日志(典型失败场景)
bash
◇ Install failed: apple-notes (exit 1) ---
Error: Your Xcode (14.3.1) at /Applications/Xcode.app is too outdated.
Please update to Xcode 16.4 (or delete it).
Xcode can be updated from the App Store.
◇ Install failed: camsnap (exit 1) ---
Error: Your Xcode (14.3.1) at /Applications/Xcode.app is too outdated.
◇ Install failed: summarize (exit 1) ---
Error: Your Xcode (14.3.1) at /Applications/Xcode.app is too outdated.
问题原因与解决方案
(App Store 搜索 Xcode)
或删除旧版本"] B -- "brew not found" --> D["安装 Homebrew
/bin/bash -c $(curl -fsSL...)"] B -- "其他依赖缺失" --> E["openclaw doctor
查看具体缺失项"] C --> F["重新安装对应 Skill
openclaw skills install
已成功安装的 Skills(Xcode 14.3.1 环境下)
实测以下 Skills 无需更新 Xcode 即可安装成功:
bash
✓ 1password ✓ bear-notes ✓ blogwatcher
✓ blucli ✓ clawhub ✓ eightctl
✓ github ✓ himalaya ✓ mcporter
✓ model-usage ✓ nano-banana-pro ✓ nano-pdf
✓ openai-whisper ✓ oracle ✓ sonoscli
✓ things-mac ✓ xurl
需要更新 Xcode 才能安装的 Skills
bash
✗ apple-notes ✗ apple-reminders ✗ camsnap
✗ gifgrep ✗ gog ✗ goplaces
✗ imsg ✗ obsidian ✗ openhue
✗ ordercli ✗ peekaboo ✗ sag
✗ songsee ✗ summarize ✗ wacli
实战建议 :Skills 安装失败不影响主程序正常聊天 。如果不需要这些特定功能,直接跳过即可。需要的话去 App Store 把 Xcode 更新到 16.4+ 再重新运行
openclaw skills install <n>。
健康检查
bash
openclaw doctor
10. 常用命令速查
常用命令)) 服务管理 openclaw gateway openclaw gateway install openclaw gateway status launchctl load/unload 配置管理 openclaw onboard openclaw config get openclaw config set openclaw doctor 模型管理 ollama list ollama pull ollama create ollama ps 面板访问 openclaw dashboard Hooks管理 openclaw hooks list openclaw hooks enable openclaw hooks disable
| 命令 | 说明 |
|---|---|
openclaw gateway |
前台启动 Gateway(macOS 通常不需要) |
openclaw dashboard |
自动用 token 打开浏览器面板 |
openclaw onboard |
重新运行初始化向导 |
openclaw doctor |
健康检查与依赖检测 |
openclaw config get |
查看当前配置 |
openclaw config set x y |
修改配置项 |
openclaw hooks list |
查看已安装 hooks |
ollama list |
查看已下载模型 |
ollama ps |
查看模型运行状态 |
tail -f ~/.openclaw/logs/gateway.log |
实时查看 Gateway 日志 |
11. 常见问题 FAQ(实战踩坑)
Q1:安装脚本报 Running doctor failed
实战日志:
bash
✗ Running doctor failed --- re-run with --verbose for details
原因 :已有旧版本配置文件,doctor 检测到不兼容配置。
解决 :这个报错不影响后续流程,onboarding 向导会继续。如需详细信息运行 openclaw doctor --verbose。
Q2:Doctor 报 SECURITY ERROR: Gateway URL uses plaintext ws://
实战日志:
bash
Error: SECURITY ERROR: Gateway URL "ws://openclaw.local:18789" uses plaintext ws://
to a non-loopback address. Both credentials and chat data would be exposed.
Fix: Use wss:// for remote gateway URLs.
原因 :旧配置文件中残留了 gateway.mode: remote + 非本地地址的配置。
解决:
bash
openclaw config set gateway.mode local
openclaw config set gateway.bind loopback
或直接用 openclaw onboard 重新配置一次,向导时选 "Use existing values" 让其自动修复。
Q3:向导完成后提示 Config already present; skipping onboarding
原因 :已有 ~/.openclaw/openclaw.json,安装脚本检测到后跳过了 onboarding。
解决:手动触发向导:
bash
openclaw onboard
Q4:浏览器打开 localhost:18789 一直报 token_missing
原因:OpenClaw 默认开启 token 认证,不能直接访问裸地址。
解决 :用 openclaw dashboard 命令打开(自动带 token),或查看 token 手动拼 URL:
bash
openclaw config get gateway.auth.token
Q5:日志一直刷 Telegram / WhatsApp 报错
原因:向导配置了相关 channel 但未完成认证。
解决:
bash
openclaw config set channels.telegram.enabled false
Q6:Skills 全部报 Your Xcode is too outdated
原因:macOS 特有问题,Xcode 14.x 无法编译新版 Homebrew 公式。
解决:去 App Store 更新 Xcode 到 16.4+,或忽略(不影响主功能)。
Q7:openclaw gateway 和 LaunchAgent 冲突,端口被占用
原因 :LaunchAgent 已经启动了 Gateway,手动再运行 openclaw gateway 导致端口冲突。
解决 :macOS 上无需手动运行 openclaw gateway,LaunchAgent 已经管好了。检查状态:
bash
launchctl list | grep openclaw
12. 模型推荐选型(Apple Silicon)
完整选型矩阵
| 模型 | 统一内存需求 | 速度(M 系列) | 拉取命令 |
|---|---|---|---|
| qwen2.5:3b | 2 GB | 极快 | ollama pull qwen2.5:3b |
| qwen2.5:7b | 5 GB | 很快 | ollama pull qwen2.5:7b |
| qwen3.5:9b | 6 GB | 很快 | ollama pull qwen3.5:9b |
| qwen2.5:14b | 10 GB | 快 | ollama pull qwen2.5:14b |
| qwen2.5:32b | 20 GB | 中 | ollama pull qwen2.5:32b |
| deepseek-r1:32b | 20 GB | 中 | ollama pull deepseek-r1:32b |
13. openclaw.json 完整配置参考
以下为经过实战验证的完整配置文件(适配 qwen3.5:9b + 本地 Ollama,macOS 环境):
json
{
"models": {
"mode": "merge",
"providers": {
"custom-127-0-0-1-11434": {
"baseUrl": "http://127.0.0.1:11434/v1",
"apiKey": "ollama",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5:9b",
"name": "Qwen3.5 9B (Local)",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 32768,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "custom-127-0-0-1-11434/qwen3.5:9b"
},
"workspace": "/Users/{用户名}/.openclaw/workspace",
"compaction": {
"mode": "safeguard"
},
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},
"session": {
"dmScope": "per-channel-peer"
},
"hooks": {
"internal": {
"enabled": true,
"entries": {
"bootstrap-extra-files": { "enabled": true },
"command-logger": { "enabled": true }
}
}
},
"channels": {
"telegram": {
"enabled": false
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token"
}
},
"skills": {
"install": {
"nodeManager": "npm"
}
}
}
Windows vs macOS 安装差异速查
| 对比项 | Windows | macOS | ||
|---|---|---|---|---|
| 安装命令 | `irm openclaw.ai/install.ps1 | iex` | `curl -fsSL openclaw.ai/install.sh | bash` |
| 包管理器 | scoop / winget | Homebrew(预装检测) | ||
| Gateway 启动 | 需手动运行 openclaw gateway |
LaunchAgent 自动管理 | ||
| Skills 主要失败原因 | brew not installed |
Xcode 版本过旧 | ||
| Skills 修复方案 | 安装 scoop 替代 | 更新 Xcode 到 16.4+ | ||
| 上下文窗口问题 | ⚠️ 必须手动创建 32k 版本模型 | ✅ 无需处理,Ollama 自动适配 | ||
| 配置文件路径 | %USERPROFILE%\.openclaw\openclaw.json |
~/.openclaw/openclaw.json |
||
| 日志路径 | %USERPROFILE%\.openclaw\logs\ |
~/.openclaw/logs/gateway.log |
总结
完成以上步骤后,你拥有了:
- 完全本地的 AI 助手,数据不出本机
- 完全免费,无需任何 API 费用
- 断网可用,不依赖任何外部服务
- 开机自启,LaunchAgent 自动管理,无感运行
本地 AI 助手"] --> B["文件管理"] A --> C["代码生成"] A --> D["网页控制"] A --> E["定时任务"] A --> F["🍎 Apple 生态
Notes / Things / Bear"] A --> G["文档分析"] style A fill:#4a0e8f,color:#fff style F fill:#1a1a2e,color:#fff
下一步探索:
- 访问 ClawHub 安装更多社区 Skills
- 配置 Telegram Bot 实现手机端随时对话
- 更新 Xcode 后重装更多 macOS 专属 Skills
- 运行
openclaw security audit --deep加固安全配置
文档版本 :2026年3月(基于 吴佳浩 OpenClaw 2026.3.2 实战整理) 官方文档 :openclaw.ai