2026-02-01 22:47:44 +01:00
|
|
|
|
---
|
|
|
|
|
|
read_when:
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- 你希望 OpenClaw 与你的主 macOS 环境隔离
|
|
|
|
|
|
- 你希望在沙箱中集成 iMessage(BlueBubbles)
|
|
|
|
|
|
- 你希望拥有一个可重置且可克隆的 macOS 环境
|
|
|
|
|
|
- 你希望比较本地与托管 macOS VM 选项
|
|
|
|
|
|
summary: 在沙箱化的 macOS VM(本地或托管)中运行 OpenClaw,适用于你需要隔离或 iMessage 的场景
|
|
|
|
|
|
title: macOS VM
|
2026-02-01 22:47:44 +01:00
|
|
|
|
x-i18n:
|
2026-03-16 07:02:46 +00:00
|
|
|
|
generated_at: "2026-03-16T06:23:59Z"
|
|
|
|
|
|
model: gpt-5.4
|
|
|
|
|
|
provider: openai
|
2026-02-01 22:47:44 +01:00
|
|
|
|
source_hash: 4d1c85a5e4945f9f0796038cd5960edecb71ec4dffb6f9686be50adb75180716
|
2026-03-16 07:02:46 +00:00
|
|
|
|
source_path: install/macos-vm.md
|
2026-02-01 22:47:44 +01:00
|
|
|
|
workflow: 15
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
# 在 macOS VM 上运行 OpenClaw(沙箱隔离)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 推荐默认方案(适用于大多数用户)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- **小型 Linux VPS**:适合始终在线的 Gateway 网关,且成本较低。参见 [VPS hosting](/vps)。
|
|
|
|
|
|
- **专用硬件**(Mac mini 或 Linux 主机):如果你希望完全控制,并为浏览器自动化获得一个**住宅 IP**。许多网站会屏蔽数据中心 IP,因此本地浏览通常效果更好。
|
|
|
|
|
|
- **混合方案:** 将 Gateway 网关放在便宜的 VPS 上,当你需要浏览器/UI 自动化时,再将你的 Mac 作为一个 **node** 连接进来。参见 [Nodes](/nodes) 和 [Gateway remote](/gateway/remote)。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
当你明确需要 macOS 独有能力(iMessage/BlueBubbles),或希望与你的日常 Mac 严格隔离时,再使用 macOS VM。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-02-03 13:23:00 -08:00
|
|
|
|
## macOS VM 选项
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-02-03 13:23:00 -08:00
|
|
|
|
### 在你的 Apple Silicon Mac 上运行本地 VM(Lume)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
使用 [Lume](https://cua.ai/docs/lume) 在你现有的 Apple Silicon Mac 上的沙箱化 macOS VM 中运行 OpenClaw。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
这样你将获得:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- 完全隔离的 macOS 环境(你的宿主机保持干净)
|
|
|
|
|
|
- 通过 BlueBubbles 获得 iMessage 支持(在 Linux/Windows 上无法实现)
|
|
|
|
|
|
- 通过克隆 VM 实现即时重置
|
2026-02-03 13:23:00 -08:00
|
|
|
|
- 无需额外硬件或云成本
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
### 托管 Mac 提供商(云端)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
如果你希望在云中使用 macOS,托管 Mac 提供商同样可行:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
- [MacStadium](https://www.macstadium.com/)(托管 Mac)
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- 其他托管 Mac 供应商也可以;请遵循它们的 VM + SSH 文档
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
一旦你获得了对 macOS VM 的 SSH 访问权限,就继续执行下面的第 6 步。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 快速路径(Lume,适合有经验的用户)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
1. 安装 Lume
|
|
|
|
|
|
2. `lume create openclaw --os macos --ipsw latest`
|
2026-03-16 07:02:46 +00:00
|
|
|
|
3. 完成设置助理,启用远程登录(SSH)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
4. `lume run openclaw --no-display`
|
2026-03-16 07:02:46 +00:00
|
|
|
|
5. SSH 登录,安装 OpenClaw,配置渠道
|
2026-02-01 22:47:44 +01:00
|
|
|
|
6. 完成
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 你需要准备的内容(Lume)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
- Apple Silicon Mac(M1/M2/M3/M4)
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- 宿主机运行 macOS Sequoia 或更高版本
|
|
|
|
|
|
- 每个 VM 大约 60 GB 可用磁盘空间
|
2026-02-01 22:47:44 +01:00
|
|
|
|
- 约 20 分钟
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 1)安装 Lume
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
如果 `~/.local/bin` 不在你的 PATH 中:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc && source ~/.zshrc
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
验证:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume --version
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
文档: [Lume Installation](https://cua.ai/docs/lume/guide/getting-started/installation)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 2)创建 macOS VM
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume create openclaw --os macos --ipsw latest
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-03 13:23:00 -08:00
|
|
|
|
这会下载 macOS 并创建 VM。VNC 窗口会自动打开。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
注意:下载可能需要一些时间,具体取决于你的网络连接。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 3)完成设置助理
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
在 VNC 窗口中:
|
|
|
|
|
|
|
|
|
|
|
|
1. 选择语言和地区
|
2026-03-16 07:02:46 +00:00
|
|
|
|
2. 跳过 Apple ID(或者如果你之后想使用 iMessage,也可以登录)
|
|
|
|
|
|
3. 创建一个用户账号(记住用户名和密码)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
4. 跳过所有可选功能
|
|
|
|
|
|
|
|
|
|
|
|
设置完成后,启用 SSH:
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
1. 打开“系统设置”→“通用”→“共享”
|
|
|
|
|
|
2. 启用“远程登录”
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 4)获取 VM 的 IP 地址
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume get openclaw
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
查找 IP 地址(通常为 `192.168.64.x`)。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 5)通过 SSH 连接到 VM
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
ssh youruser@192.168.64.X
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
将 `youruser` 替换为你创建的账号,并将 IP 替换为你的 VM IP。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 6)安装 OpenClaw
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-02-03 13:23:00 -08:00
|
|
|
|
在 VM 内:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
npm install -g openclaw@latest
|
|
|
|
|
|
openclaw onboard --install-daemon
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-02 15:46:45 +01:00
|
|
|
|
按照新手引导提示设置你的模型提供商(Anthropic、OpenAI 等)。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 7)配置渠道
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
编辑配置文件:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
nano ~/.openclaw/openclaw.json
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
添加你的渠道:
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"channels": {
|
|
|
|
|
|
"whatsapp": {
|
|
|
|
|
|
"dmPolicy": "allowlist",
|
|
|
|
|
|
"allowFrom": ["+15551234567"]
|
|
|
|
|
|
},
|
|
|
|
|
|
"telegram": {
|
|
|
|
|
|
"botToken": "YOUR_BOT_TOKEN"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
然后登录 WhatsApp(扫描 QR 码):
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw channels login
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 8)以无界面方式运行 VM
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
停止 VM,然后在无显示模式下重启:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume stop openclaw
|
|
|
|
|
|
lume run openclaw --no-display
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
VM 会在后台运行。OpenClaw 的守护进程会保持 Gateway 网关持续运行。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
检查状态:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
ssh youruser@192.168.64.X "openclaw status"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 加分项:iMessage 集成
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
这是在 macOS 上运行的杀手级特性。使用 [BlueBubbles](https://bluebubbles.app) 将 iMessage 添加到 OpenClaw。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-02-03 13:23:00 -08:00
|
|
|
|
在 VM 内:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
1. 从 bluebubbles.app 下载 BlueBubbles
|
2026-03-16 07:02:46 +00:00
|
|
|
|
2. 使用你的 Apple ID 登录
|
|
|
|
|
|
3. 启用 Web API 并设置一个密码
|
|
|
|
|
|
4. 将 BlueBubbles webhook 指向你的 gateway(示例:`https://your-gateway-host:3000/bluebubbles-webhook?password=<password>`)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
添加到你的 OpenClaw 配置中:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"channels": {
|
|
|
|
|
|
"bluebubbles": {
|
|
|
|
|
|
"serverUrl": "http://localhost:1234",
|
|
|
|
|
|
"password": "your-api-password",
|
|
|
|
|
|
"webhookPath": "/bluebubbles-webhook"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
重启 Gateway 网关。现在你的智能体就可以发送和接收 iMessage 了。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
完整设置细节: [BlueBubbles channel](/channels/bluebubbles)
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 保存黄金镜像
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
在进一步自定义之前,为你的干净状态创建快照:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume stop openclaw
|
|
|
|
|
|
lume clone openclaw openclaw-golden
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
随时重置:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
lume stop openclaw && lume delete openclaw
|
|
|
|
|
|
lume clone openclaw-golden openclaw
|
|
|
|
|
|
lume run openclaw --no-display
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
## 7×24 运行
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
通过以下方式保持 VM 持续运行:
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- 让你的 Mac 保持通电
|
|
|
|
|
|
- 在“系统设置”→“节能”中禁用睡眠
|
|
|
|
|
|
- 如有需要,使用 `caffeinate`
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
如果你需要真正始终在线,请考虑使用专用 Mac mini 或小型 VPS。参见 [VPS hosting](/vps)。
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 故障排除
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
| 问题 | 解决方案 |
|
|
|
|
|
|
| ----------------------- | ----------------------------------------------------------------- |
|
|
|
|
|
|
| 无法通过 SSH 连接到 VM | 检查 VM 的“系统设置”中是否已启用“远程登录” |
|
|
|
|
|
|
| 未显示 VM IP | 等待 VM 完全启动后,再次运行 `lume get openclaw` |
|
|
|
|
|
|
| 找不到 `lume` 命令 | 将 `~/.local/bin` 添加到你的 PATH |
|
|
|
|
|
|
| 无法扫描 WhatsApp QR 码 | 运行 `openclaw channels login` 时,确保你登录的是 VM 而不是宿主机 |
|
2026-02-01 22:47:44 +01:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
2026-03-16 07:02:46 +00:00
|
|
|
|
- [VPS hosting](/vps)
|
|
|
|
|
|
- [Nodes](/nodes)
|
|
|
|
|
|
- [Gateway remote](/gateway/remote)
|
|
|
|
|
|
- [BlueBubbles channel](/channels/bluebubbles)
|
|
|
|
|
|
- [Lume Quickstart](https://cua.ai/docs/lume/guide/getting-started/quickstart)
|
|
|
|
|
|
- [Lume CLI Reference](https://cua.ai/docs/lume/reference/cli-reference)
|
|
|
|
|
|
- [Unattended VM Setup](https://cua.ai/docs/lume/guide/fundamentals/unattended-setup)(高级)
|
|
|
|
|
|
- [Docker Sandboxing](/install/docker)(另一种隔离方案)
|