macOS VM 上的 OpenClaw(沙盒)

推薦預設(大多數使用者)

  • 小型 Linux VPS 用於永遠在線的閘道和低成本。參見 VPS 託管
  • 專用硬體(Mac mini 或 Linux 主機)如果你需要完全控制和用於瀏覽器自動化的住宅 IP。許多網站封鎖資料中心 IP,因此本機瀏覽通常效果更好。
  • 混合模式: 閘道放在便宜的 VPS 上,需要瀏覽器/UI 自動化時連接 Mac 作為 node。參見 Nodes遠端閘道

當你特別需要 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 文件

取得 macOS VM 的 SSH 存取後,從下方步驟 6 繼續。


快速路徑(Lume,有經驗的使用者)

  1. 安裝 Lume
  2. lume create openclaw --os macos --ipsw latest
  3. 完成 Setup Assistant,啟用 Remote Login(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 Installation


2) 建立 macOS VM

lume create openclaw --os macos --ipsw latest

下載 macOS 並建立 VM。VNC 視窗會自動開啟。

備註:下載時間取決於網路速度。


3) 完成 Setup Assistant

在 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

依照初始設定提示設定模型供應商(Anthropic、OpenAI 等)。


7) 設定頻道

編輯設定檔:

nano ~/.openclaw/openclaw.json

新增頻道:

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

然後登入 WhatsApp(掃描 QR):

openclaw channels login

8) 以 headless 模式執行 VM

停止 VM 並在無顯示的情況下重啟:

lume stop openclaw
lume run openclaw --no-display

VM 在背景執行。OpenClaw 的 daemon 維持閘道運行。

檢查狀態:

ssh [email protected] "openclaw status"

額外功能:iMessage 整合

在 macOS 上執行的殺手級功能。使用 BlueBubbles 將 iMessage 加入 OpenClaw。

在 VM 內:

  1. 從 bluebubbles.app 下載 BlueBubbles
  2. 以 Apple ID 登入
  3. 啟用 Web API 並設定密碼
  4. 將 BlueBubbles webhook 指向你的閘道(範例:https://your-gateway-host:3000/bluebubbles-webhook?password=<password>

加入 OpenClaw 設定:

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

重啟閘道。現在你的 agent 可以收發 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 無法掃描確認在 VM(非主機)中執行 openclaw channels login

相關文件