🖥️ Mac Mini Server
Complete guide to running OpenClaw on a Mac Mini as an always-on AI server. From hardware selection to monitoring.
1. Hardware Recommendations
Mac Mini M4 (2024) — $499 base
| Spec | Base | Upgraded |
|---|
| CPU | 10-core | 10-core |
| GPU |
10-core | 10-core |
| RAM | 16GB | 32GB (+$200) |
| Storage | 256GB | 512GB (+$200) |
Best for: Personal assistant, small team, cloud API-only usage.
Recommendation: Upgrade to 32GB RAM ($699 total) — worth it for Docker overhead + future local models.
Mac Mini M4 Pro — $1,399 base
| Spec | Base | Upgraded |
|---|
| CPU | 12-core | 14-core |
| GPU |
16-core | 20-core |
| RAM | 24GB | 48GB (+$200) / 64GB (+$400) |
| Storage | 512GB | 1TB (+$200) |
Best for: Local model inference (Ollama), multiple clients, heavy workloads.
Recommendation: 48GB RAM ($1,599) for running 7B-13B models locally alongside OpenClaw.
Which One?
| Use Case | Pick | Why |
|---|
| Cloud APIs only (Claude, GPT) | M4 32GB | Plenty of power, great value |
| Local + cloud hybrid |
M4 Pro 48GB | Run Ollama + OpenClaw together |
| Multi-client server | M4 Pro 64GB | Headroom for multiple agents |
| Budget-conscious | M4 16GB | Works fine for single user |
2. macOS Initial Setup
Disable Sleep & Energy Settings
CODEBLOCK0
System Settings UI path: System Settings → Energy → set all to Never.
Enable Auto-Login
- 1. System Settings → Users & Groups → Automatic Login → select your user
- System Settings → Lock Screen → disable "Require password"
⚠️ Only do this on a physically secure machine. The Mac Mini should be in a locked location.
Disable Automatic Updates Reboots
CODEBLOCK1
Update manually on your schedule instead.
Enable Remote Access
CODEBLOCK2
3. Homebrew + Docker Desktop
Install Homebrew
CODEBLOCK3
Install Docker Desktop
CODEBLOCK4
Docker Desktop Settings:
- - Resources → CPUs: leave 2 for macOS, give rest to Docker
- Resources → Memory: leave 4GB for macOS, give rest to Docker
- General → Start Docker Desktop when you sign in: ✅
Install Essential Tools
CODEBLOCK5
4. OpenClaw Docker Compose Setup
Clone and Build
CODEBLOCK6
Configure
CODEBLOCK7
docker-compose.yml
CODEBLOCK8
⚠️ ALWAYS use 127.0.0.1: prefix on ports. Never expose to 0.0.0.0.
Launch
CODEBLOCK9
5. Launchd Service (Auto-Start on Boot)
Create ~/Library/LaunchAgents/com.openclaw.gateway.plist:
CODEBLOCK10
CODEBLOCK11
6. Tailscale for Remote Access
CODEBLOCK12
Access from Anywhere
- - SSH: INLINECODE3
- OpenClaw: INLINECODE4
- No port forwarding needed
- End-to-end encrypted
Tailscale ACLs (recommended)
In the Tailscale admin console, restrict who can access the Mac Mini:
{
"acls": [
{"action": "accept", "src": ["your-devices"], "dst": ["mac-mini:*"]}
]
}
7. Telegram Bot Configuration
CODEBLOCK14
Add to config:
CODEBLOCK15
CODEBLOCK16
8. Port Forwarding Alternatives
If Tailscale isn't an option:
| Method | Pros | Cons |
|---|
| Tailscale (recommended) | Zero config, encrypted, free | Requires client on each device |
| Cloudflare Tunnel |
Free, no open ports | Slight latency, CF dependency |
|
ngrok | Easy setup | Free tier limited, costs for production |
|
Router port forwarding | Direct access | Security risk, dynamic IP issues |
|
WireGuard | Fast, self-hosted | Manual setup, maintain yourself |
Cloudflare Tunnel (alternative to Tailscale)
CODEBLOCK17
9. UPS Recommendations
A UPS prevents data corruption during power outages and gives time for graceful shutdown.
| Model | Capacity | Runtime | Price | Best For |
|---|
| APC BE425M | 425VA | ~15min | $55 | Budget, Mac Mini only |
| CyberPower CP685AVRG |
685VA | ~20min | $80 | Mac Mini + router |
| APC BR700G | 700VA | ~25min | $120 | Mac Mini + monitor + router |
| CyberPower CP1500PFCLCD | 1500VA | ~45min | $220 | Full setup with margin |
Recommendation: CyberPower CP685AVRG — enough for Mac Mini + router, good price-to-runtime ratio.
Auto-Shutdown on Power Loss
CODEBLOCK18
10. Monitoring and Alerts
Basic Health Check Script
Save as ~/{baseDir}/scripts/health_check.sh:
CODEBLOCK19
Cron-Based Monitoring
CODEBLOCK20
System Metrics
CODEBLOCK21
Uptime Monitoring (External)
Consider free external monitors:
11. Cost Comparison
Mac Mini M4 32GB ($699 one-time)
| Item | Monthly Cost |
|---|
| Electricity (~15W average) | ~$2 |
| Internet (existing) |
$0 |
| Tailscale | Free |
| AI APIs | $50-500 |
|
Total |
$52-502/mo |
|
Year 1 (with hardware) |
$1,323-6,723 |
|
Year 2+ |
$624-6,024 |
VPS (Hetzner CX32 — 4 vCPU, 8GB RAM)
| Item | Monthly Cost |
|---|
| Server | $15 |
| AI APIs |
$50-500 |
|
Total |
$65-515/mo |
|
Year 1 |
$780-6,180 |
Cloud (AWS t3.large)
| Item | Monthly Cost |
|---|
| EC2 | $60 |
| Storage |
$10 |
| Bandwidth | $5-20 |
| AI APIs | $50-500 |
|
Total |
$125-590/mo |
|
Year 1 |
$1,500-7,080 |
Verdict
| Factor | Mac Mini | VPS | Cloud |
|---|
| Upfront cost | $699 | $0 | $0 |
| Monthly cost |
Lowest | Low | Highest |
| Performance | Best (M4 chip) | Good | Good |
| Latency | Depends on internet | Consistent | Consistent |
| Maintenance | You handle | Managed | Managed |
| Local models | ✅ Yes | ❌ No | ❌ Expensive |
| Break-even vs VPS | ~4 years | — | — |
TL;DR: Mac Mini wins if you want local model capability or plan to run 2+ years. VPS wins for simplicity and no upfront cost. Cloud is for enterprises with compliance needs.
Quick Start Checklist
- - [ ] Buy Mac Mini (M4 32GB recommended)
- [ ] macOS setup (disable sleep, auto-login, SSH)
- [ ] Install Homebrew, Docker, tools
- [ ] Clone and build OpenClaw
- [ ] Configure INLINECODE6
- [ ] INLINECODE7
- [ ] Set up launchd auto-start
- [ ] Install and configure Tailscale
- [ ] Set up Telegram bot
- [ ] Connect UPS
- [ ] Configure health monitoring
- [ ] Test reboot recovery
Credits
Built by
M. Abidi |
agxntsix.ai
YouTube |
GitHub
Part of the
AgxntSix Skill Suite for OpenClaw agents.
📅 Need help setting up OpenClaw for your business? Book a free consultation
🖥️ Mac Mini 服务器
在 Mac Mini 上运行 OpenClaw 作为始终在线的 AI 服务器的完整指南。涵盖从硬件选择到监控的全流程。
1. 硬件推荐
Mac Mini M4(2024)— 基础版 $499
10核 | 10核 |
| 内存 | 16GB | 32GB(+$200) |
| 存储 | 256GB | 512GB(+$200) |
最佳适用场景: 个人助手、小团队、仅使用云 API。
推荐建议: 升级至 32GB 内存(总计 $699)—— 对于 Docker 开销和未来本地模型而言值得投资。
Mac Mini M4 Pro — 基础版 $1,399
16核 | 20核 |
| 内存 | 24GB | 48GB(+$200)/ 64GB(+$400) |
| 存储 | 512GB | 1TB(+$200) |
最佳适用场景: 本地模型推理(Ollama)、多客户端、高负载工作。
推荐建议: 48GB 内存($1,599)用于在 OpenClaw 旁同时运行 7B-13B 本地模型。
如何选择?
| 使用场景 | 推荐型号 | 原因 |
|---|
| 仅使用云 API(Claude、GPT) | M4 32GB | 性能充足,性价比高 |
| 本地 + 云混合 |
M4 Pro 48GB | 可同时运行 Ollama + OpenClaw |
| 多客户端服务器 | M4 Pro 64GB | 为多个代理预留空间 |
| 预算有限 | M4 16GB | 单用户使用完全足够 |
2. macOS 初始设置
禁用睡眠与节能设置
bash
完全阻止睡眠
sudo pmset -a sleep 0
sudo pmset -a disksleep 0
sudo pmset -a displaysleep 0
断电后自动重启
sudo pmset -a autorestart 1
禁用休眠
sudo pmset -a hibernatemode 0
验证设置
pmset -g
系统设置 UI 路径: 系统设置 → 节能 → 全部设为永不。
启用自动登录
- 1. 系统设置 → 用户与群组 → 自动登录 → 选择你的用户
- 系统设置 → 锁定屏幕 → 禁用需要密码
⚠️ 仅在物理安全的机器上执行此操作。Mac Mini 应放置在可锁定的位置。
禁用自动更新重启
bash
防止自动重启以安装更新
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticallyInstallMacOSUpdates -bool false
改为按计划手动更新。
启用远程访问
bash
启用 SSH
sudo systemsetup -setremotelogin on
启用屏幕共享(可选)
sudo defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
3. Homebrew + Docker Desktop
安装 Homebrew
bash
/bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
echo eval $(/opt/homebrew/bin/brew shellenv) >> ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
安装 Docker Desktop
bash
brew install --cask docker
启动 Docker Desktop
open -a Docker
等待 Docker 启动,然后验证
docker --version
docker compose version
Docker Desktop 设置:
- - 资源 → CPU:为 macOS 保留 2 核,其余分配给 Docker
- 资源 → 内存:为 macOS 保留 4GB,其余分配给 Docker
- 通用 → 登录时启动 Docker Desktop:✅
安装必要工具
bash
brew install git node pnpm tailscale jq htop
4. OpenClaw Docker Compose 设置
克隆与构建
bash
cd ~
git clone https://github.com/openclaw/openclaw.git
cd openclaw
安装依赖并构建
pnpm install
pnpm build
构建 Docker 镜像
docker build -t openclaw:latest .
配置
bash
mkdir -p ~/.openclaw
cp openclaw.example.json ~/.openclaw/openclaw.json
nano ~/.openclaw/openclaw.json
docker-compose.yml
yaml
version: 3.8
services:
openclaw-gateway:
image: openclaw:latest
container_name: openclaw-gateway
restart: unless-stopped
volumes:
- ~/.openclaw:/home/node/.openclaw
- ./:/host/openclaw:rw
- /var/run/docker.sock:/var/run/docker.sock
- ~/.ssh:/home/node/.ssh:ro
ports:
- 127.0.0.1:3000:3000
environment:
- NODE_ENV=production
⚠️ 始终在端口前使用 127.0.0.1: 前缀。切勿暴露到 0.0.0.0。
启动
bash
docker compose up -d
docker compose logs -f # 验证启动
5. Launchd 服务(开机自启)
创建 ~/Library/LaunchAgents/com.openclaw.gateway.plist:
xml
Label
com.openclaw.gateway
ProgramArguments
/usr/local/bin/docker
compose
-f
/Users/YOUR_USER/openclaw/docker-compose.yml
up
-d
RunAtLoad
KeepAlive
StartInterval
300
StandardOutPath
/tmp/openclaw-launchd.log
StandardErrorPath
/tmp/openclaw-launchd-err.log
EnvironmentVariables
PATH
/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin
bash
将 YOUR_USER 替换为实际用户名
sed -i s/YOUR_USER/$(whoami)/g ~/Library/LaunchAgents/com.openclaw.gateway.plist
加载服务
launchctl load ~/Library/LaunchAgents/com.openclaw.gateway.plist
验证
launchctl list | grep openclaw
6. Tailscale 远程访问
bash
安装(已通过 brew 完成)
brew install --cask tailscale
或使用 CLI 版本
brew install tailscale
启动并认证
sudo tailscale up
获取你的 Tailscale IP
tailscale ip -4
启用 Tailscale Serve 实现 HTTPS
tailscale serve https / http://127.0.0.1:3000
从任何地方访问
- - SSH:ssh user@100.x.x.x
- OpenClaw:https://mac-mini.tail-xxxxx.ts.net
- 无需端口转发
- 端到端加密
Tailscale ACL(推荐)
在 Tailscale 管理控制台中,限制谁可以访问 Mac Mini:
json
{
acls: [
{action: accept, src: [your-devices], dst: [mac-mini:*]}
]
}