| name | openclaw-local-mac-mini |
| description | Set up OpenClaw locally and run it reliably on a Mac mini for private, always-on local agent workflows. |
| license | MIT |
| metadata | {"author":"devops-skills","version":"1.0"} |
OpenClaw Local + Mac mini Setup
Use this skill when you want to run OpenClaw on a developer laptop or promote it to a stable Mac mini host. Covers cloning and bootstrapping, Docker Compose configuration, Mac mini hardware optimization, networking, monitoring, and production-grade launchd services.
When to Use
- Running OpenClaw as a private, always-on local AI agent
- Setting up a dedicated Mac mini as a home-lab AI server
- Deploying OpenClaw with Docker Compose for reproducible environments
- Optimizing macOS for headless server operation
- Monitoring a local AI service for uptime and performance
Prerequisites
- macOS 13 (Ventura) or later on Apple Silicon (M1/M2/M4 Mac mini recommended)
- Docker Desktop for Mac or OrbStack installed
- Git, Node.js (v18+), and a package manager (npm or pnpm)
- API keys for your chosen LLM provider (OpenAI, Anthropic, or local Ollama)
- At least 16 GB RAM (32 GB recommended for local model serving)
Local Setup (Any Dev Machine)
Clone and Bootstrap
git clone https://github.com/openclaw/openclaw.git
cd openclaw
cat README.md
cp .env.example .env
cat > .env << 'ENV'
OPENAI_API_KEY=sk-your-openai-key-here
NODE_ENV=development
PORT=3000
HOST=0.0.0.0
LOG_LEVEL=info
DATABASE_URL=sqlite:./data/openclaw.db
ENV
Install Dependencies and Run
npm install
npm run db:migrate
npm run dev
curl -s http://localhost:3000/api/health | jq .
Validate the Setup
curl -f http://localhost:3000/api/health
curl -s -o /dev/null -w '%{http_code}' http://localhost:3000/
npm test
Docker Compose Setup
docker-compose.yml
version: "3.8"
services:
openclaw:
build:
context: .
dockerfile: Dockerfile
image: openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3000:3000"
env_file:
- .env
environment:
- NODE_ENV=production
- HOST=0.0.0.0
- PORT=3000
volumes:
- openclaw-data:/app/data
- ./config:/app/config:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
deploy:
resources:
limits:
memory: 4G
reservations:
memory:
[, , ]
[, , , ]
Running with Docker Compose
docker compose up -d --build
docker compose ps
docker compose logs -f openclaw
docker compose logs -f --tail=100 ollama
docker exec openclaw-ollama ollama pull llama3:8b
docker exec openclaw-ollama ollama list
docker compose restart openclaw
docker compose down
docker compose down -v
Mac mini Production Setup
macOS Hardening and Baseline
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool true
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CriticalUpdateInstall -bool true
sudo fdesetup enable
sudo pmset -a sleep 0
sudo pmset -a disksleep 0
sudo pmset -a displaysleep 0
sudo pmset -a autorestart 1
defaults -currentHost write com.apple.screensaver idleTime 0
sudo scutil --set ComputerName "openclaw-mini"
sudo scutil --set HostName "openclaw-mini"
sudo scutil --set LocalHostName "openclaw-mini"
pmset -g
Dedicated User Account
sudo sysadminctl -addUser openclaw -fullName "OpenClaw Service" -password "temp-change-me" -admin
su - openclaw
cd ~
git clone https://github.com/openclaw/openclaw.git
cd openclaw
cp .env.example .env
Secrets Management
security add-generic-password -a openclaw -s "OPENAI_API_KEY" -w "sk-your-key-here"
security add-generic-password -a openclaw -s "ANTHROPIC_API_KEY" -w "sk-ant-your-key-here"
OPENAI_API_KEY=$(security find-generic-password -a openclaw -s "OPENAI_API_KEY" -w)
export OPENAI_API_KEY
cat > /Users/openclaw/openclaw/load-secrets.sh << 'SCRIPT'
export OPENAI_API_KEY=$(security find-generic-password -a openclaw -s "OPENAI_API_KEY" -w 2>/dev/null)
export ANTHROPIC_API_KEY=$(security find-generic-password -a openclaw -s "ANTHROPIC_API_KEY" -w 2>/dev/null)
SCRIPT
chmod 700 /Users/openclaw/openclaw/load-secrets.sh
launchd Service Configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.openclaw.service</string>
<key>UserName</key>
<string>openclaw</string>
<key>WorkingDirectory</key>
<string>/Users/openclaw/openclaw</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>source ./load-secrets.sh && /usr/local/bin/node ./dist/server.js</string>
</>
EnvironmentVariables
NODE_ENV
production
PORT
3000
HOST
0.0.0.0
PATH
/usr/local/bin:/usr/bin:/bin
RunAtLoad
KeepAlive
SuccessfulExit
ThrottleInterval
10
StandardOutPath
/var/log/openclaw/stdout.log
StandardErrorPath
/var/log/openclaw/stderr.log
SoftResourceLimits
NumberOfFiles
65536
sudo mkdir -p /var/log/openclaw
sudo chown openclaw:staff /var/log/openclaw
sudo launchctl load -w /Library/LaunchDaemons/com.openclaw.service.plist
sudo launchctl list | grep openclaw
curl -f http://localhost:3000/api/health
sudo launchctl stop com.openclaw.service
sudo launchctl start com.openclaw.service
sudo launchctl unload /Library/LaunchDaemons/com.openclaw.service.plist
tail -f /var/log/openclaw/stdout.log
tail -f /var/log/openclaw/stderr.log
Docker Compose via launchd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.openclaw.docker</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/docker</string>
<string>compose</string>
<string>-f</string>
<string>/Users/openclaw/openclaw/docker-compose.yml</string>
<string>up</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive
StandardOutPath
/var/log/openclaw/docker-stdout.log
StandardErrorPath
/var/log/openclaw/docker-stderr.log
Networking
Tailscale for Secure Remote Access
brew install --cask tailscale
open /Applications/Tailscale.app
tailscale up --authkey tskey-auth-your-key-here
tailscale ip -4
curl http://100.64.x.x:3000/api/health
Nginx Reverse Proxy (Optional)
brew install nginx
cat > /opt/homebrew/etc/nginx/servers/openclaw.conf << 'NGINX'
server {
listen 80;
server_name openclaw-mini openclaw-mini.local;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
location /api/ {
limit_req zone=api burst=20 nodelay;
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
NGINX
nginx -t
brew services restart nginx
macOS Firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/bin/node
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /opt/homebrew/bin/nginx
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setblockall on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
Monitoring
Health Check Script
#!/usr/bin/env bash
set -euo pipefail
ENDPOINT="http://localhost:3000/api/health"
LOGFILE="/var/log/openclaw/healthcheck.log"
ALERT_EMAIL="admin@example.com"
MAX_FAILURES=3
FAILURE_COUNT_FILE="/tmp/openclaw-failures"
timestamp() { date '+%Y-%m-%d %H:%M:%S'; }
if [ ! -f "$FAILURE_COUNT_FILE" ]; then
echo 0 > "$FAILURE_COUNT_FILE"
fi
if curl -sf --max-time 10 "$ENDPOINT" > /dev/null 2>&1; then
echo "$(timestamp) OK" >> "$LOGFILE"
echo 0 > "$FAILURE_COUNT_FILE"
else
FAILURES=$(cat "$FAILURE_COUNT_FILE")
FAILURES=$((FAILURES + 1))
echo "$FAILURES" > "$FAILURE_COUNT_FILE"
echo "$(timestamp) FAIL (count: $FAILURES)" >> "$LOGFILE"
if [ "$FAILURES" -ge ];
>>
launchctl stop com.openclaw.service
2
launchctl start com.openclaw.service
>>
0 >
crontab -e
Resource Monitoring
ps aux | grep -E 'node|docker' | grep -v grep
top -l 1 -s 0 | grep -E 'node|docker'
df -h /Users/openclaw
du -sh /Users/openclaw/openclaw/data/
docker stats --no-stream openclaw openclaw-redis openclaw-ollama
sudo powermetrics --samplers cpu_power,gpu_power -n 1
Log Rotation
/var/log/openclaw/stdout.log openclaw:staff 644 10 5120 * JN
/var/log/openclaw/stderr.log openclaw:staff 644 10 5120 * JN
/var/log/openclaw/healthcheck.log openclaw:staff 644 10 1024 * JN
sudo newsyslog -F
cat > /Users/openclaw/rotate-logs.sh << 'ROTATE'
LOGDIR="/var/log/openclaw"
for log in "$LOGDIR"/*.log; do
if [ -f "$log" ] && [ "$(stat -f%z "$log")" -gt 52428800 ]; then
mv "$log" "${log}.$(date +%Y%m%d%H%M%S)"
gzip "${log}."*
touch "$log"
fi
done
ls -t "$LOGDIR"/*.gz 2>/dev/null | tail -n +11 | xargs rm -f
ROTATE
chmod +x /Users/openclaw/rotate-logs.sh
Validation Checklist
- App starts after reboot without manual intervention (
launchctl list | grep openclaw)
- Health check succeeds from local network (
curl -f http://<ip>:3000/api/health)
- Health check succeeds via Tailscale (
curl -f http://100.64.x.x:3000/api/health)
- Secrets are not committed and not world-readable (
ls -la .env, check .gitignore)
- Access to admin interfaces is restricted to trusted users/devices
- Docker volumes persist across container restarts (
docker compose down && docker compose up -d)
- Log rotation is active and disk usage stays bounded
- Automatic restart works after crash (kill the process and verify relaunch)
Troubleshooting
| Symptom | Diagnostic | Fix |
|---|
| Slow responses | top -l 1, check model backend | Verify RAM/CPU pressure; use a smaller model or remote API |
| Boot failures | sudo launchctl list, check logs | Inspect /var/log/openclaw/stderr.log, fix working directory |
| Auth errors | Check .env or Keychain secrets | Re-check provider keys, scopes, and endpoint URLs |
| Random crashes | log show --predicate 'process == "node"' | Pin dependency versions, check for OOM in dmesg |
| Port 3000 in use | lsof -i :3000 | Kill conflicting process or change PORT in .env |
| Docker won't start | docker info, docker compose logs | Ensure Docker Desktop/OrbStack is running |
| Ollama model slow | docker stats openclaw-ollama | Allocate more RAM to Docker, use quantized model |
| Tailscale unreachable | tailscale status, ping 100.64.x.x | Re-authenticate with tailscale up, check firewall |
| Disk full | df -h, du -sh ~/openclaw/data/ | Prune Docker images (docker system prune), rotate logs |
Related Skills