OpenClaw on Mac Mini: Build a 24/7 AI Agent Server
A Mac Mini sitting on your desk can run five AI agents around the clock for less than $5 a month in electricity. This guide covers everything you need to turn a Mac Mini into a production-grade OpenClaw agent server, from hardware selection and Docker setup to Ollama local inference and multi-agent orchestration.
Why Mac Mini for AI Agents?
Running AI agents on your laptop works until you close the lid. Running them on a VPS works until the monthly bill arrives. The Mac Mini sits in a sweet spot that makes it the ideal hardware for a personal AI agent server. Here is why.
Always on, whisper quiet
Apple Silicon Mac Minis have no fan noise under normal workloads. They draw 5 to 15 watts at idle, which means you can run one 24/7 in your home office without hearing it and without noticing it on your electricity bill. It is the kind of machine you plug in once and forget about.
Low power, high performance
The M-series chips pack serious compute into a tiny power envelope. An M2 Mac Mini delivers performance comparable to a server-class Xeon processor while sipping less power than a desk lamp. For AI workloads, the unified memory architecture means the Neural Engine and GPU share the full RAM pool with zero copy overhead.
M-series chips are built for AI
Apple Silicon includes a dedicated Neural Engine and a powerful GPU that share unified memory with the CPU. This architecture is ideal for running local language models through Ollama. A 16GB Mac Mini can run 7B parameter models at interactive speeds without a discrete GPU.
macOS just works for servers
macOS has launchd for service management, built-in SSH, native Docker support through Apple's virtualization framework, and decades of Unix heritage. You do not need to learn a new OS or fight driver compatibility issues. Install OpenClaw, configure a launchd plist, and your agents survive reboots, crashes, and power outages automatically.
Hardware Recommendations
Not every Mac Mini is equal for agent workloads. The right configuration depends on whether you plan to use cloud-based LLMs, run local models with Ollama, or both. Here is a breakdown by use case.
| Use Case | Recommended Chip | RAM | Storage | Approx. Price |
|---|---|---|---|---|
| Cloud LLMs only (2-3 agents) | M1 or M2 | 8GB | 256GB SSD | $350 - $450 |
| Cloud LLMs + Ollama 7B (3-5 agents) | M2 or M4 | 16GB | 256GB SSD | $500 - $650 |
| Multi-agent + Ollama 13B+ models | M4 | 24GB | 512GB SSD | $700 - $900 |
| Heavy multi-agent + multiple local models | M4 Pro | 32GB+ | 512GB SSD | $1,200+ |
Our recommendation: The M2 Mac Mini with 16GB RAM is the sweet spot for most users. It handles cloud-based LLM agents without breaking a sweat, runs 7B local models through Ollama at usable speeds, and you can find refurbished units for around $500. If you know you want to run larger local models or more than 5 agents, spring for the M4 with 24GB.
Storage note: Agent workloads are not storage-intensive. The base 256GB SSD is enough unless you plan to download many large Ollama models (each 7B model is roughly 4GB, 13B models are 7-8GB). If you want to keep several models available, go with 512GB.
Initial Setup: Headless Mac Mini
A server does not need a monitor, keyboard, or mouse after initial configuration. Here is how to set up your Mac Mini for headless operation so you can manage it entirely over SSH.
Enable Remote Login (SSH)
Go to System Settings, then General, then Sharing, and turn on Remote Login. This enables SSH access so you can connect from any other machine on your network.
Configure Energy Saver
# Or configure via terminal:
# Prevent sleep when display is off
sudo pmset -a disablesleep 1
# Restart automatically after power failure
sudo pmset -a autorestart 1
# Never put hard disks to sleep
sudo pmset -a disksleep 0
# Disable display sleep (optional, saves energy on headless)
sudo pmset -a displaysleep 1
# Verify settings
pmset -gSet Up Auto-Login
For launchd agents (user-level services) to start automatically, your user account needs to log in at boot. Go to System Settings, then Users and Groups, then Login Options, and set Automatic Login to your user account. This ensures that after a reboot, your user session starts and all launchd agents load without manual intervention.
Test SSH Access
# Find your Mac Mini's local IP
# On the Mac Mini, run:
ipconfig getifaddr en0
# From your laptop, connect via SSH
ssh yourusername@192.168.1.XXX
# or use the hostname:
ssh yourusername@your-mac-mini.local
# Once connected, verify the system
uname -a
sw_versOnce SSH is working, you can disconnect the monitor, keyboard, and mouse. Everything from here forward can be done remotely.
Installing OpenClaw on Mac Mini
OpenClaw has three main installation paths: direct with Node.js, containerized with Docker, or combined with Ollama for local inference. We will cover all three.
Option 1: Direct Installation (Node.js)
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js 20 LTS
brew install node@20
# Install OpenClaw globally
npm install -g openclaw
# Verify
openclaw --version
node --version # Should show v20.x
# Initialize workspace
mkdir -p ~/openclaw-server && cd ~/openclaw-server
openclaw initOption 2: Docker Installation
Docker isolates each agent in its own container, making dependency management and cleanup trivial. Docker Desktop for Mac runs natively on Apple Silicon with minimal overhead.
# Install Docker Desktop via Homebrew
brew install --cask docker
# Start Docker Desktop (first time requires GUI interaction)
open -a Docker
# Verify Docker is running
docker --version
docker compose version
# Pull the OpenClaw base image
docker pull openclaw/agent:latestOption 3: Ollama for Local Inference
Ollama lets you run open-source language models locally on your Mac Mini. This means zero API costs and complete data privacy. Install it alongside OpenClaw so your agents can use local models as their LLM backend.
# Install Ollama
brew install ollama
# Start Ollama service (runs in background)
brew services start ollama
# Pull recommended models for agent workloads
ollama pull llama3.1:8b # General purpose, great for most tasks
ollama pull mistral:7b # Fast, good for structured outputs
ollama pull codellama:13b # Code generation and analysis
# Verify models are available
ollama list
# Test a model
ollama run llama3.1:8b "Summarize the key metrics for a SaaS business"Ollama exposes a local API at http://localhost:11434 that is compatible with the OpenAI API format. OpenClaw can connect to it directly by setting the model endpoint in your agent configuration.
Running Multiple Agents with Docker Compose
The real power of a dedicated Mac Mini server is running multiple specialized agents simultaneously. Docker Compose lets you define all your agents in a single configuration file, start them together, and manage them as a unit.
version: "3.8"
services:
gateway:
image: openclaw/gateway:latest
ports:
- "18789:18789"
environment:
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- OLLAMA_HOST=http://host.docker.internal:11434
volumes:
- ./agents:/app/agents
- ./logs:/app/logs
restart: always
deploy:
resources:
limits:
memory: 512M
pm-agent:
image: openclaw/agent:latest
volumes:
- ./agents/pm/SOUL.md:/app/SOUL.md
environment:
- AGENT_NAME=orion
- GATEWAY_URL=http://gateway:18789
- MODEL=claude-sonnet-4-20250514
depends_on:
- gateway
restart: always
deploy:
resources:
limits:
memory: 256M
writer-agent:
image: openclaw/agent:latest
volumes:
- ./agents/writer/SOUL.md:/app/SOUL.md
environment:
- AGENT_NAME=echo
- GATEWAY_URL=http://gateway:18789
- MODEL=claude-sonnet-4-20250514
depends_on:
- gateway
restart: always
deploy:
resources:
limits:
memory: 256M
support-agent:
image: openclaw/agent:latest
volumes:
- ./agents/support/SOUL.md:/app/SOUL.md
environment:
- AGENT_NAME=helper
- GATEWAY_URL=http://gateway:18789
- MODEL=ollama/llama3.1:8b
depends_on:
- gateway
restart: always
deploy:
resources:
limits:
memory: 256M
devops-agent:
image: openclaw/agent:latest
volumes:
- ./agents/devops/SOUL.md:/app/SOUL.md
environment:
- AGENT_NAME=sentinel
- GATEWAY_URL=http://gateway:18789
- MODEL=claude-sonnet-4-20250514
depends_on:
- gateway
restart: always
deploy:
resources:
limits:
memory: 256M
analyst-agent:
image: openclaw/agent:latest
volumes:
- ./agents/analyst/SOUL.md:/app/SOUL.md
environment:
- AGENT_NAME=atlas
- GATEWAY_URL=http://gateway:18789
- MODEL=ollama/mistral:7b
depends_on:
- gateway
restart: always
deploy:
resources:
limits:
memory: 256M# Start all agents
docker compose up -d
# Check status of all containers
docker compose ps
# View logs for a specific agent
docker compose logs -f writer-agent
# Restart a single agent without affecting others
docker compose restart support-agent
# Stop everything
docker compose down
# Update to latest images and restart
docker compose pull && docker compose up -dNotice the restart: always policy on every service. This tells Docker to restart any container that crashes or stops, and to bring all services back up after a system reboot. Combined with Docker Desktop's "Start Docker Desktop when you sign in" setting, your entire agent fleet recovers automatically from power outages.
Resource Allocation Tips
Cloud LLM agents are lightweight
Agents using Claude or GPT-4 only need 128-256MB of RAM each. The heavy lifting happens on the API provider's servers. A Mac Mini with 8GB can run 5-8 of these agents comfortably alongside Docker and the OS.
Local model agents share the model
When multiple agents use the same Ollama model, the model is loaded into memory once and shared. Two agents using llama3.1:8b do not consume double the memory. The model uses roughly 5GB, plus 256MB per agent process.
Mix cloud and local strategically
Use cloud LLMs for tasks that need frontier intelligence (complex reasoning, coding, nuanced writing) and local models for high-volume, simpler tasks (classification, summarization, templated responses). This keeps API costs low while maintaining quality where it matters.
Running with Ollama: Free Local Inference
One of the biggest advantages of running OpenClaw on your own hardware is eliminating API costs entirely. Ollama makes this practical by running open-source models locally with GPU acceleration on Apple Silicon.
Configuring an Agent for Ollama
# Support Agent
## Identity
- Name: Helper
- Role: Customer Support Agent
- Model: ollama/llama3.1:8b
- Endpoint: http://localhost:11434
## Personality
- Friendly and patient
- Responds in clear, simple language
- Escalates complex issues to the human team
- Always acknowledges the customer's frustration before solving
## Rules
- Keep responses under 200 words
- Never share internal system details with customers
- If you cannot solve the issue in 2 messages, escalate
- Always end with "Is there anything else I can help with?"
## Channels
- telegram: Receive support requests via Telegram
- slack: Monitor the #support channelModel Recommendations by Task
| Model | Size | RAM Required | Best For | Speed (M2 16GB) |
|---|---|---|---|---|
| llama3.1:8b | 4.7GB | 8GB+ | General purpose, conversation, Q&A | ~35 tok/s |
| mistral:7b | 4.1GB | 8GB+ | Structured output, classification | ~40 tok/s |
| codellama:13b | 7.4GB | 16GB+ | Code generation, debugging, DevOps | ~18 tok/s |
| llama3.1:70b-q4 | 40GB | 48GB+ | Near-frontier quality, complex reasoning | N/A (needs 48GB+) |
| phi3:mini | 2.3GB | 4GB+ | Lightweight tasks, summarization | ~55 tok/s |
For most agent tasks, llama3.1:8b is the best balance of quality and speed. It fits comfortably on an 8GB Mac Mini with room for the OS and agent processes. If you need better reasoning and have 16GB, step up to codellama:13b for technical agents.
Hybrid Setup: Cloud + Local
You do not have to choose between cloud and local. The smartest setup uses both. Route high-stakes tasks (strategy, complex writing, code review) to Claude or GPT-4 via API, and route high-volume repetitive tasks (support responses, log summarization, data classification) to local Ollama models. Your API bill drops by 60-80% while maintaining quality where it matters.
Monitoring and Maintenance
A production agent server needs monitoring. You need to know when agents crash, when resources run low, and when logs need rotation. Here is a complete maintenance setup.
Auto-Restart with launchd
If you are running OpenClaw directly (not Docker), use launchd to keep the gateway alive. This plist ensures the gateway starts at login and restarts within seconds if it crashes.
<?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>ai.openclaw.gateway</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/node</string>
<string>/opt/homebrew/bin/openclaw</string>
<string>gateway</string>
<string>start</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/yourusername/openclaw-server</string>
<key>EnvironmentVariables</key>
<dict>
<key>ANTHROPIC_API_KEY</key>
<string>your-api-key-here</string>
<key>OLLAMA_HOST</key>
<string>http://localhost:11434</string>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ThrottleInterval</key>
<integer>10</integer>
<key>StandardOutPath</key>
<string>/Users/yourusername/openclaw-server/logs/gateway.log</string>
<key>StandardErrorPath</key>
<string>/Users/yourusername/openclaw-server/logs/gateway-error.log</string>
</dict>
</plist># Create log directory
mkdir -p ~/openclaw-server/logs
# Load the service
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
# Verify it is running
launchctl list | grep openclawLog Rotation
Agent logs grow over time. Without rotation, they can fill your disk. Set up a simple cron job to rotate logs weekly.
#!/bin/bash
LOG_DIR="$HOME/openclaw-server/logs"
RETENTION_DAYS=30
# Rotate current logs
cd "$LOG_DIR"
for log in *.log; do
if [ -f "$log" ]; then
mv "$log" "$log.$(date +%Y%m%d)"
fi
done
# Delete logs older than retention period
find "$LOG_DIR" -name "*.log.*" -mtime +$RETENTION_DAYS -delete
# Restart gateway to pick up new log files
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist# Open crontab
crontab -e
# Add weekly log rotation (every Sunday at 3 AM)
0 3 * * 0 /bin/bash ~/openclaw-server/scripts/rotate-logs.shHealth Check Script
#!/bin/bash
# Check if OpenClaw gateway is responding
RESPONSE=$(curl -s -o /dev/null -w "%[HTTP_CODE]" http://localhost:18789/health)
if [ "$RESPONSE" != "200" ]; then
echo "[ALERT] OpenClaw gateway is down! HTTP status: $RESPONSE"
# Restart the gateway
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
echo "[INFO] Gateway restarted at $(date)"
fi
# Check Ollama status
if ! curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
echo "[ALERT] Ollama is not responding!"
brew services restart ollama
echo "[INFO] Ollama restarted at $(date)"
fi
# Check disk space (alert if less than 10GB free)
FREE_SPACE=$(df -g / | tail -1 | awk '{print $4}')
if [ "$FREE_SPACE" -lt 10 ]; then
echo "[ALERT] Low disk space: $FREE_SPACE GB remaining"
fi
# Check memory usage
MEMORY_PRESSURE=$(memory_pressure | head -1)
echo "[INFO] $MEMORY_PRESSURE"# Add to crontab
*/5 * * * * /bin/bash ~/openclaw-server/scripts/health-check.sh >> ~/openclaw-server/logs/health.log 2>&1Real-World Example: 5 Agents on One Mac Mini
Here is a production setup running five specialized agents on a single M2 Mac Mini with 16GB RAM. This is a real configuration used by a solo founder running a SaaS product.
Orion (PM Agent) - Claude Sonnet
Manages tasks, prioritizes backlogs, writes daily standup summaries. Connects to GitHub issues and Notion. Uses cloud LLM because strategic planning needs frontier intelligence. Runs via Telegram for mobile access.
Echo (Content Writer) - Claude Sonnet
Writes blog posts, social media content, and email sequences. Takes topic briefs from Orion and produces publish-ready drafts. Uses cloud LLM for writing quality. Output goes to markdown files in the workspace.
Helper (Support Agent) - Ollama llama3.1:8b
Handles customer support tickets via Slack. Responds to common questions using a knowledge base of FAQ documents. Uses a local model because support responses are templated and high-volume. Escalates complex issues to Telegram.
Sentinel (DevOps Agent) - Claude Sonnet
Monitors server health, deployment status, and error logs. Runs periodic health checks and alerts the founder via Telegram when something breaks. Uses cloud LLM for its ability to analyze complex error logs and stack traces.
Atlas (Data Analyst) - Ollama mistral:7b
Pulls GA4, Mixpanel, and Stripe data daily. Generates morning reports with key metrics, trends, and anomalies. Uses a local model because the analysis follows a consistent template and the data summarization task is well-structured.
Resource Usage (Measured)
| Component | RAM Usage | CPU (idle) |
|---|---|---|
| macOS + system processes | ~3GB | 2-5% |
| OpenClaw gateway | ~200MB | 1-2% |
| 3 cloud LLM agents (Orion, Echo, Sentinel) | ~500MB total | 0-1% |
| Ollama (llama3.1:8b loaded) | ~5GB | 0-1% |
| 2 local model agents (Helper, Atlas) | ~400MB total | 0-1% |
| Total | ~9.1GB | 4-10% |
With 16GB total, this setup leaves roughly 7GB of headroom for macOS to use as file cache and for occasional spikes when agents process requests simultaneously. The system never swaps under normal operation and stays responsive over SSH.
Cost Comparison: Mac Mini vs VPS vs Cloud
Running agents costs money whether you own the hardware or rent it. Here is an honest cost comparison over 12 months for running 5 agents, factoring in both hardware and operating costs.
| Cost Category | Mac Mini (M2 16GB) | VPS (16GB RAM) | Cloud Functions |
|---|---|---|---|
| Upfront hardware | $550 | $0 | $0 |
| Monthly hosting/electricity | $3/mo | $60/mo | $40-100/mo |
| LLM API costs (cloud only) | $15/mo (hybrid) | $40/mo (all cloud) | $40/mo (all cloud) |
| Local model capability | Yes (Ollama) | No (no GPU) | No |
| 12-month total cost | $766 | $1,200 | $960 - $1,680 |
| 24-month total cost | $982 | $2,400 | $1,920 - $3,360 |
| Data privacy | Full (your machine) | Limited (hosted) | Limited (hosted) |
The Mac Mini wins decisively on total cost of ownership. The upfront investment of $550 pays for itself within 6 months compared to a VPS, and the gap widens every month after that. The hybrid approach (using Ollama for 2 out of 5 agents) cuts LLM API costs by roughly 60%, which adds up to hundreds of dollars per year.
The VPS makes sense only if you need a public IP address, guaranteed uptime SLAs, or if your team is distributed across locations and needs centralized access. For solo founders and small teams, the Mac Mini is the better deal by a wide margin.
Get Started with Pre-Built Agent Packages
Setting up a Mac Mini server is the infrastructure half of the equation. The other half is building agents that actually do useful work. Writing SOUL.md files, configuring channels, defining skills, and testing behavior takes time to get right.
CrewClaw has a library of over 160 pre-built agent templates covering PM, content writing, customer support, DevOps, data analysis, and dozens of other roles. Each template comes with a production-ready SOUL.md, recommended model configuration, and channel setup. Pick a template, customize the personality and rules for your use case, and deploy to your Mac Mini in minutes.
Frequently Asked Questions
What are the minimum system requirements for OpenClaw?
OpenClaw requires Node.js 18 or later, at least 4GB of RAM, and roughly 500MB of disk space for the core installation. If you plan to run local models through Ollama, you need a minimum of 8GB RAM for 3B parameter models and 16GB for 7B models. Apple Silicon Macs are recommended because their unified memory architecture allows the GPU and CPU to share the same RAM pool, which significantly improves local model inference speed.
Can I run OpenClaw with Docker on a Mac Mini?
Yes. Docker Desktop for Mac runs natively on Apple Silicon and is fully compatible with OpenClaw. Using Docker gives you isolated containers for each agent, easier dependency management, and the ability to use docker-compose to orchestrate multiple agents with a single configuration file. The overhead is minimal on Apple Silicon since Docker uses the native virtualization framework rather than emulation.
How many agents can a Mac Mini run simultaneously?
It depends on your hardware and whether you use cloud LLMs or local models. A Mac Mini with 8GB RAM can handle 5 to 8 agents using cloud-based LLMs like Claude or GPT-4, since the agents themselves are lightweight Node.js processes. With Ollama running a 7B local model, a 16GB Mac Mini can handle 3 to 5 agents sharing the same model. A 24GB M4 Mac Mini can comfortably run 5 to 8 agents with a 13B local model loaded.
Is Ollama free to use with OpenClaw?
Yes, Ollama is completely free and open source. It runs local language models on your Mac Mini without any API costs or usage limits. You download models once, and they run entirely on your hardware. This means zero per-token costs, no rate limits, and complete data privacy since nothing leaves your machine. The trade-off is that local models are generally less capable than frontier cloud models like Claude Sonnet or GPT-4, but they work well for many agent tasks like summarization, classification, and templated responses.
What happens if the Mac Mini loses power or restarts?
If you configure your agents as launchd services or use Docker with restart policies, everything comes back online automatically. Enable 'Start up automatically after a power failure' in System Settings under Energy Saver. With launchd's KeepAlive directive or Docker's restart: always policy, your agents will be running again within 60 to 90 seconds of the Mac Mini booting up. For mission-critical setups, connect the Mac Mini to a small UPS battery backup to survive brief power outages without rebooting at all.
Should I use Docker or run OpenClaw directly on macOS?
For a single agent or simple setup, running directly on macOS with a launchd service is simpler and has zero overhead. For multi-agent setups with different dependencies, Docker is better because each agent gets its own isolated environment. Docker also makes it easier to replicate your setup on another machine or migrate to a VPS later. If you are comfortable with Docker, use it from the start. If you prefer simplicity, start with direct installation and switch to Docker when complexity grows.
Build your AI agent team with CrewClaw
Over 160 pre-built agent templates. Pick a role, customize, and deploy to your Mac Mini in minutes. No SOUL.md writing required.
Deploy a Ready-Made AI Agent
Skip the setup. Pick a template and deploy in 60 seconds.