昨天弄出一個簡單的工具 macstrap ,方便未來快速批次處理 mac mini M4。然而,mac mini M4 一開始還是有幾個步驟需要人工處理的。
初次把 Mac mini 開機,過程會設定網路連線,以及設定一組帳密登入。進入系統後:
- Sound: 聲音調成靜音
- Energy: 開啟避免自動睡眠、電源失敗後可自動開機、網路喚醒
- General: Sharing -> Remote Login: On
- General: Sharing -> Remote Management: On -> 選項全開, 密碼設置, 指定使用者使用且選項全開
- General: About -> Name -> 可以改成簡短的名稱,如 mac-mini ,好處就是可以用 ssh mac-mini.local 連線
- 開啟 termnial -> 輸入 python3 -> 會觸動透過 Xcode 安裝 python3 環境
如此就完成 mac mini 可被遠端操作的基本設定了,可以測試:
- ssh user@mac-mini.local
- 開啟 螢幕共享 -> 輸入 mac-mini.local -> 選擇帳號登入
以上兩種就是可遠端的配置了,而多了 python3 的安裝,是為了用 macstrap 快速安置開發環境
```% mkdir openclaw-on-mac-mini && cd openclaw-on-mac-mini% python3 -m venv venv && source venv/bin/activate && pip install macstrap% macstrap init --examples% macstrap ssh-auth mac-mini.local --user user...✓ Passwordless SSH to mac-mini.local working....✓ Sudo password stored in macOS Keychain% macstrap run --config examples/ai-cli --config examples/openclaw mac-mini.local...```
如此系統就會安裝一些常見的 AI cli (OpenAI - Codex CLI, Google - Gemini CLI, Microsoft - Copilot CLI), Openclaw 跟 Docker Desktop 也安裝好了,而 Docker Desktop 需要登入 macOS 上先來個手動啟動,啟動後可以在設定區開啟 Start Docker Desktop when you sign into your computer,而這台 mac mini M4 是 32GB RAM 跟 1TB SSD ,因此可以多善用 Docker 來封裝一些任務做風險管控。
接著就是啟動 openclaw 的部分了,可以在 macos Desktop 啟動,也可以用 ssh 登入啟動,在此用後者:
```% ssh user@mac-mini.localuser@mac-mini ~ % openclaw onboard🦞 OpenClaw 2026.3.8 (3caab92)I'm not AI-powered, I'm AI-possessed. Big difference.▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░████░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░████░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀🦞 OPENCLAW 🦞┌ OpenClaw onboarding│...```
我們採用 QuickStart ,以及 Copilot (Github + local proxy) ,而 Copilot CLI 認證方式採用 `GitHub Copilot (GitHub device login) (Uses GitHub device flow)`,且模型就挑 `GPT-5 mini` 好了
主因是 Github Copilot 在 2026-03-11 的模型費用:
```Search models...Claude Sonnet 4.5 (default) ✓ 1xClaude Haiku 4.5 0.33xClaude Opus 4.6 3xClaude Opus 4.6 (fast mode) (Preview) (requires enablement) 30xClaude Opus 4.5 3xClaude Sonnet 4 1xGemini 3 Pro (Preview) 1xGPT-5.3-Codex 1xGPT-5.2-Codex 1xGPT-5.2 1xGPT-5.1-Codex-Max 1xGPT-5.1-Codex 1xGPT-5.1 1xGPT-5.1-Codex-Mini (Preview) 0.33x❯ GPT-5 mini 0xGPT-4.1 0x```
若表現太差就換到 `Claude Sonnet 4.5`
接著就是跟龍蝦溝通的方式 `Select channel (QuickStart)`
```◆ Select channel (QuickStart)│ ● Telegram (Bot API) (recommended · newcomer-friendly)│ ○ WhatsApp (QR link)│ ○ Discord (Bot API)│ ○ IRC (Server + Nick)│ ○ Google Chat (Chat API)│ ○ Slack (Socket Mode)│ ○ Signal (signal-cli)│ ○ iMessage (imsg)│ ○ LINE (Messaging API)│ ○ Feishu/Lark (飞书)│ ○ Nostr (NIP-04 DMs)│ ○ Microsoft Teams (Bot Framework)│ ○ Mattermost (plugin)│ ○ Nextcloud Talk (self-hosted)│ ○ Matrix (plugin)│ ○ BlueBubbles (macOS app)│ ○ Zalo (Bot API)│ ○ Zalo (Personal Account)│ ○ Synology Chat (Webhook)│ ○ Tlon (Urbit)│ ○ Skip for now└```
就是一下 Telegram 吧,設定滿簡單的,只要到 Telegram BotFather 上註冊一個 Bot 即可,過程會給予 HTTP API token ,回 OpenClaw 貼上即可。
接著 Install missing skill dependencies 的部分,就挑一下 macOS 系列: apple-notes, apple-reminders, openai-whisper 等等:
◆ Install missing skill dependencies│ ◻ Skip for now (Continue without installing dependencies)│ ◻ 🔐 1password│ ◼ 📝 apple-notes (Manage Apple Notes via the `memo` CLI on macOS│ (create, view, edit, delete, search, move,…)│ ◼ ⏰ apple-reminders (Manage Apple Reminders via remindctl CLI│ (list, add, edit, complete, delete). Supports li…)│ ◻ 🐻 bear-notes│ ◻ 📰 blogwatcher│ ◻ 🫐 blucli│ ◻ 📸 camsnap│ ◻ 🧩 clawhub│ ◻ 🎛️ eightctl│ ◻ 🧲 gifgrep│ ◻ 🎮 gog│ ◻ 📍 goplaces│ ◻ 📧 himalaya│ ◻ 📨 imsg│ ◻ 📦 mcporter│ ◻ 📊 model-usage│ ◻ 🍌 nano-banana-pro│ ◻ 📄 nano-pdf│ ◻ 💎 obsidian│ ◼ 🎙️ openai-whisper (Local speech-to-text with the Whisper CLI (no│ API key). — Install OpenAI Whisper (brew))│ ◻ 💡 openhue│ ◻ 🧿 oracle│ ◻ 🛵 ordercli│ ◻ 👀 peekaboo│ ◻ 🗣️ sag│ ◻ 🌊 songsee│ ◻ 🔊 sonoscli│ ◻ 🧾 summarize│ ◻ ✅ things-mac│ ◻ 🎞️ video-frames│ ◻ 📱 wacli│ ◻ 𝕏 xurl└
接著 hooks 就全裝,最後就差不多搞定了。
未來想要打開設定,可以改用 openclaw dashboard 指令,將允許在 http://localhost:12345/ 類似的網址瀏覽。
這邊提一下 telegram 連線有問題的處理方式:
- 先在 Telegram BotFather 那邊查看 Bot 的情況,像是用 `/mybots` ,接著可以查看指定 bot 的 api token
- 直接在 mac mini 上編輯 ~/.openclaw/openclaw.json 檔案,確認:
- 查看 channels.telegram 的設定,如 enabled: true, dmPolicy: pairing, 以及可以順便更新一下 botToken 等
- 在 mac mini 使用指令 `openclaw gateway` 運行
- 在 Telegram Bot 上,打 `/start` 指令
- 在 mac mini 使用指令 `openclaw pairing list telegram`
- 如果有看到配對碼,就用 `openclaw pairing approve telegram <CODE>` 生效他
最後,設定一下開機自動執行 openclaw ,這邊單純用 crontab 管理,還有其他更佳的方案,之後再來研究:
```user@mac-mini ~ % which openclaw/Users/user/.nvm/versions/node/v22.22.1/bin/openclawuser@mac-mini ~ % crontab -l@reboot PATH=$PATH:$HOME/.nvm/versions/node/v22.22.1/bin/ $HOME/.nvm/versions/node/v22.22.1/bin/openclaw gateway >> $HOME/openclaw.log 2>&1```


沒有留言:
張貼留言