在macOS 虚拟机上运行 OpenClaw(沙箱化)

推荐默认设置(大多数用户?

  • 小型 Linux VPS 用于常驻 Gateway 和低成本。参?VPS 托管?
  • 专用硬件(Mac mini ?Linux 盒子)如果你想要完全控制和一?*住宅 IP**用于浏览器自动化。许多网站会阻止数据中心 IP,所以本地浏览通常效果更好?
  • 混合模式?*?Gateway 保持在便宜的 VPS 上,当需要浏览器/UI 自动化时,将你的 Mac 作为节点**连接。参见节点 ?Gateway 远程?

当你特别需?macOS 独有功能(iMessage/BlueBubbles)或想与日常使用?Mac 严格隔离时,请使?macOS VM?

macOS VM 选项

在你?Apple Silicon Mac 上运行本?VM(Lume?

使用 Lume 在你现有?Apple Silicon Mac 上的沙箱?macOS VM 中运?OpenClaw?

这为你提供:

  • 隔离的完?macOS 环境(你的主机保持干净?
  • 通过 BlueBubbles 支持 iMessage(在 Linux/Windows 上不可能?
  • 通过克隆 VM 立即重置
  • 无额外硬件或云成?

托管 Mac providers(云?

如果你想在云中运?macOS,托?Mac providers 也可以:

  • MacStadium(托?Mac?
  • 其他托管 Mac 供应商也可以工作;按照他们的 VM + SSH 文档操作

一旦你获得?macOS VM ?SSH 访问权限,继续下面的?6 步?


快速路径(Lume,有经验的用户)

  1. 安装 Lume
  2. lume create openclaw --os macos --ipsw latest
  3. 完成设置助手,启用远程登录(SSH?
  4. lume run openclaw --no-display
  5. SSH 进入,安?OpenClaw,配置频?
  6. 完成

你需要的(Lume?

  • Apple Silicon Mac(M1/M2/M3/M4?
  • 主机上运?macOS Sequoia 或更高版?
  • 每个 VM ?60 GB 可用磁盘空间
  • ?20 分钟

1) 安装 Lume

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"

如果 ~/.local/bin 不在你的 PATH 中:

echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc && source ~/.zshrc

验证?

lume --version

文档:Lume 安装


2) 创建 macOS VM

lume create openclaw --os macos --ipsw latest

这会下载 macOS 并创?VM。VNC 窗口会自动打开?

注意:下载可能需要一些时间,取决于你的连接速度?


3) 完成设置助手

?VNC 窗口中:

  1. 选择语言和区?
  2. 跳过 Apple ID(或如果你想要稍后使?iMessage,则登录?
  3. 创建一个用户账户(记住用户名和密码?
  4. 跳过所有可选功?

设置完成后,启用 SSH?

  1. 打开系统设置 ?通用 ?共享
  2. 启用”远程登录”

4) 获取 VM ?IP 地址

lume get openclaw

查找 IP 地址(通常?192.168.64.x)?


5) SSH 进入 VM

ssh [email protected]

?youruser 替换为你创建的用户账户,IP 替换为你?VM ?IP?


6) 安装 OpenClaw

?VM 内:

npm install -g openclaw@latest
openclaw onboard --install-daemon

按照入门提示设置你的模型 provider(Anthropic、OpenAI 等)?


7) 配置频道

编辑配置文件?

nano ~/.openclaw/openclaw.json

添加你的频道?

{
  "channels": {
    "whatsapp": {
      "dmPolicy": "allowlist",
      "allowFrom": ["+15551234567"]
    },
    "telegram": {
      "botToken": "YOUR_BOT_TOKEN"
    }
  }
}

然后登录 WhatsApp(扫?QR):

openclaw channels login

8) 无头运行 VM

停止 VM 并无显示重启?

lume stop openclaw
lume run openclaw --no-display

VM 在后台运行。OpenClaw 的守护进程保?gateway 运行?

检查状态:

ssh [email protected] "openclaw status"

附加功能:iMessage 集成

这是?macOS 上运行的核心功能。使?BlueBubbles ?iMessage 添加?OpenClaw?

?VM 内:

  1. ?bluebubbles.app 下载 BlueBubbles
  2. 使用你的 Apple ID 登录
  3. 启用 Web API 并设置密?
  4. ?BlueBubbles webhooks 指向你的 gateway(示例:https://your-gateway-host:3000/bluebubbles-webhook?password=<password>?

添加到你?OpenClaw 配置?

{
  "channels": {
    "bluebubbles": {
      "serverUrl": "http://localhost:1234",
      "password": "your-api-password",
      "webhookPath": "/bluebubbles-webhook"
    }
  }
}

重启 gateway。现在你的代理可以发送和接收 iMessage 了?

完整设置详情:BlueBubbles 频道


保存黄金镜像

在进一步自定义之前,拍摄你的干净状态的快照?

lume stop openclaw
lume clone openclaw openclaw-golden

随时重置?

lume stop openclaw && lume delete openclaw
lume clone openclaw-golden openclaw
lume run openclaw --no-display

全天候运?

通过以下方式保持 VM 运行?

  • 保持 Mac 插入电源
  • 在系统设??节能中禁用睡?
  • 如需要使?caffeinate

为了真正的常驻运行,请考虑专用?Mac mini 或小?VPS。参?VPS 托管?


故障排除

问题解决方案
无法 SSH 进入 VM检?VM 的系统设置中是否启用?远程登录”
VM IP 不显?等待 VM 完全启动,重新运?lume get openclaw
找不?Lume 命令?~/.local/bin 添加到你?PATH
WhatsApp QR 扫描不了确保在运?openclaw channels login 时你已登?VM(不是主机)

相关文档