Skip to content
广告 · 本站推荐广告

macOS 虚拟机

在 macOS 虚拟机(VM)中运行 OpenClaw,适用于以下场景:

  • 🔒 沙箱隔离:在独立 VM 中运行,不影响宿主机
  • 💬 iMessage 集成:OpenClaw 可通过 AppleScript 操作 iMessage,需要完整 macOS 环境
  • 🧪 测试环境:快速创建 / 销毁干净的 macOS 实例

使用 Lume

Lume 是一个轻量级 macOS 虚拟机管理工具,基于 Apple Virtualization.framework。

前置条件

  • macOS 13+ (Ventura) 宿主机
  • Apple Silicon(M1/M2/M3/M4)
  • 至少 16 GB 宿主机内存

安装 Lume

bash
brew install lume

创建 macOS VM

bash
# 下载 macOS IPSW 恢复镜像并创建 VM
lume create openclaw-vm \
  --os macos \
  --cpu 4 \
  --memory 8192 \
  --disk 60

# 启动 VM
lume start openclaw-vm

在 VM 中安装 OpenClaw

VM 启动后,通过 VNC 或 SSH 连入:

bash
# SSH 进入 VM(需要先在 VM 中启用远程登录)
ssh user@$(lume ip openclaw-vm)

# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash

# 启动
openclaw start

iMessage 集成

在 macOS VM 中,OpenClaw 可以通过 AppleScript 读取和发送 iMessage:

  1. 在 VM 中登录 Apple ID
  2. 确保 Messages.app 已登录
  3. 在 OpenClaw 配置中启用 iMessage Channel:
yaml
# ~/.openclaw/config/gateway.yaml
channels:
  imessage:
    enabled: true
    poll_interval: 5s

隐私提醒

iMessage 集成需要访问你的 Apple ID 账号。建议使用 专用 Apple ID,不要使用个人主账号。


VM 管理

bash
# 列出所有 VM
lume list

# 停止 VM
lume stop openclaw-vm

# 删除 VM
lume delete openclaw-vm

# 创建快照
lume snapshot create openclaw-vm --name clean-install

性能调优

参数推荐值说明
CPU4 核最少 2 核
内存8 GB最少 4 GB
磁盘60 GBmacOS + OpenClaw + 数据

🇨🇳 中国用户须知

macOS VM 方案仅适用于 macOS 宿主机(Apple Silicon)。如果你在 Linux / Windows 上使用,该方案不适用。iMessage 集成是 macOS 独有功能,国内用户更常用的对话渠道是企业微信 / 飞书 / 钉钉,这些不需要 macOS VM。

基于MIT协议开源 | 内容翻译自 官方文档,同步更新