Skip to main content

Documentation Index

Fetch the complete documentation index at: https://openclaw.zhcndoc.com/llms.txt

Use this file to discover all available pages before exploring further.

在 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 提供商(云端)

如果你想在云端使用 macOS,托管 Mac 提供商也可以:
  • MacStadium(托管 Mac)
  • 其他托管 Mac 厂商也可以;请遵循它们的 VM + SSH 文档
一旦你能通过 SSH 访问 macOS VM,就继续执行下面的第 6 步。

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

  1. 安装 Lume
  2. lume create openclaw --os macos --ipsw latest
  3. 完成设置助手,启用远程登录(SSH)
  4. lume run openclaw --no-display
  5. SSH 登录,安装 OpenClaw,配置 channels
  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 youruser@192.168.64.X
youruser 替换为你创建的账户,并将 IP 替换为你的 VM 的 IP。

6)安装 OpenClaw

在 VM 内:
npm install -g openclaw@latest
openclaw onboard --install-daemon
按照引导提示设置你的模型提供商(Anthropic、OpenAI 等)。

7)配置 channels

编辑配置文件:
nano ~/.openclaw/openclaw.json
添加你的 channels:
{
  channels: {
    whatsapp: {
      dmPolicy: "allowlist",
      allowFrom: ["+15551234567"],
    },
    telegram: {
      botToken: "YOUR_BOT_TOKEN",
    },
  },
}
然后登录 WhatsApp(扫描二维码):
openclaw channels login

8)以无界面模式运行 VM

停止 VM 并在不显示界面的情况下重新启动:
lume stop openclaw
lume run openclaw --no-display
VM 会在后台运行。OpenClaw 的守护进程会保持 Gateway 运行。 检查状态:
ssh youruser@192.168.64.X "openclaw status"

额外功能:iMessage 集成

这是在 macOS 上运行的杀手级功能。使用 BlueBubbles 为 OpenClaw 添加 iMessage。 在 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。现在你的 agent 可以收发 iMessages 了。 完整设置详情:BlueBubbles channel

保存金镜像

在进一步自定义之前,先快照你的干净状态:
lume stop openclaw
lume clone openclaw openclaw-golden
随时重置:
lume stop openclaw && lume delete openclaw
lume clone openclaw-golden openclaw
lume run openclaw --no-display

24/7 运行

通过以下方式保持 VM 运行:
  • 保持你的 Mac 接通电源
  • 在 系统设置 → 节能 中禁用睡眠
  • 如有需要,使用 caffeinate
如果需要真正的始终在线,建议使用专用 Mac mini 或小型 VPS。参见 VPS 托管

故障排查

问题解决方案
无法 SSH 进入 VM检查 VM 的 系统设置 中是否已启用“远程登录”
没有显示 VM IP等待 VM 完全启动后,再次运行 lume get openclaw
找不到 Lume 命令~/.local/bin 添加到你的 PATH
WhatsApp 二维码无法扫描运行 openclaw channels login 时,请确保你登录的是 VM(不是宿主机)

相关文档