← Back to BlogTutorial

How to Set Up an AI Agent on a Mac Mini Server

H.··7 min read

The Mac Mini with an M-series chip is quietly one of the best AI agent servers you can buy. $599 gets you a machine that sips power, runs silent, and has enough compute to handle multiple AI agents without breaking a sweat.

This isn't a cloud tutorial. This is "buy a Mac Mini, put it on your desk, and have a personal AI agent running 24/7 for the cost of leaving a light on." Here's how.

Why a Mac Mini?

Three reasons people use cloud servers for AI agents: convenience, reliability, and "that's what everyone does." Here's why a Mac Mini beats all three:

Cost. A comparable cloud VM runs $40-80/month. That's $480-960/year. The Mac Mini pays for itself in 8-12 months. After that, it's free compute forever. The electricity cost is roughly $3/month. Seriously.

Privacy. Your emails, calendar events, CRM data, and Slack messages never leave your physical location. No cloud provider reads your data. No third-party has access. You can literally unplug the ethernet cable and the agent keeps processing local tasks.

Performance. The M-series chips handle inference surprisingly well. You can run local models for simple classification tasks and only hit cloud APIs (GPT-4, Claude) for complex reasoning. That cuts your API costs by 60-70%.

What You'll Need

Step 1: Initial Mac Setup

Unbox the Mac Mini. Connect it to a monitor, keyboard, and mouse for the initial setup. After this, you won't need them again.

Set it up with a dedicated admin account. Not your personal Apple ID. Create a new one specifically for this machine. If the Mac Mini gets compromised, you don't want your personal iCloud exposed.

Go to System Settings > Energy Saver (or Battery):

This ensures your agent survives power outages and doesn't go to sleep at 3am.

Step 2: Enable Remote Access

Go to System Settings > General > Sharing:

Test SSH from another machine:

ssh youradmin@mac-mini-ip

Once SSH works, you can disconnect the monitor and keyboard. Everything from here is remote.

Step 3: Install Dependencies

SSH into the Mac Mini and install the basics:

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Node.js
brew install node@22

# Install Docker
brew install --cask docker
open /Applications/Docker.app
# Wait for Docker to start, then:
docker --version

# Install OpenClaw
npm install -g openclaw

Docker note: Docker Desktop on macOS has a GUI component. You'll need to open it once via the command line or screen sharing to accept the license. After that, it runs as a background service.

Step 4: Configure OpenClaw

Run the initial setup:

openclaw init

This creates your config directory and walks you through basic configuration:

For API keys, use OpenClaw's built-in credential encryption:

openclaw configure --section llm

Never store API keys in plaintext files. Not even in .env. OpenClaw encrypts them with a keyring-based system. Use it.

Step 5: Docker Sandboxing

This is the step most people skip. Don't.

Your AI agent will have access to your email, calendar, and potentially shell commands. Running it inside Docker means that even if the agent does something unexpected, the damage is contained.

Create a docker-compose.yml for your OpenClaw setup:

version: '3.8'
services:
  openclaw:
    image: node:22-slim
    volumes:
      - ./workspace:/home/openclaw/workspace
      - ./config:/home/openclaw/.openclaw
    environment:
      - NODE_ENV=production
    network_mode: bridge
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    read_only: true
    tmpfs:
      - /tmp:size=100M

The key security options:

Step 6: Security Hardening

Three things that protect your Mac Mini from the internet:

Firewall. macOS has a built-in firewall. Enable it:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

Only allow SSH (port 22) and your gateway port through.

SSH hardening. Edit /etc/ssh/sshd_config:

PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
MaxAuthTries 3

Use SSH keys only. No passwords. If someone tries to brute-force your SSH, they'll hit a wall.

Fail2ban equivalent. macOS doesn't have Fail2ban natively, but you can use a launchd plist to monitor and block IPs after failed SSH attempts. Or use a tool like sshguard:

brew install sshguard

Step 7: Connect Your Tools

Now the fun part. Connect your agent to the services it'll manage:

# Gmail (see our Gmail integration guide)
openclaw configure --section google-workspace

# Slack
openclaw configure --section slack

# Calendar
# (handled by Google Workspace config above)

Each integration requires OAuth setup. Budget 15-20 minutes per service for the first-time configuration. Our Gmail integration guide walks through the OAuth process in detail.

Step 8: Start the Agent

# Start the OpenClaw gateway as a background service
openclaw gateway start

# Verify it's running
openclaw gateway status

Set it to start automatically on boot:

openclaw gateway start --auto

Your agent is now running. 24/7. Silently processing email, managing your calendar, and waiting for instructions in Slack.

Monitoring Your Agent

You can't just set it and forget it. At least not in the first week. Monitor:

After a week of stable operation, you can dial back monitoring to a daily check-in.

Cost Breakdown

| Item | Cost | |------|------| | Mac Mini (M2, 16GB) | $599 (one-time) | | Electricity (~6W idle, ~15W active) | ~$3/month | | API costs (GPT-4 + Claude mix) | ~$15-30/month | | Domain (optional) | ~$12/year | | Total Year 1 | ~$830 | | Total Year 2+ | ~$220/year |

Compare this to a cloud VM ($40-80/month = $480-960/year) plus you retain full control of your data and hardware.

When to NOT Use a Mac Mini

Be honest about the tradeoffs:

For most individuals and small businesses, the Mac Mini is the sweet spot between power, cost, and simplicity.

The Lazy Option

If the words "Docker," "SSH hardening," and "Fail2ban" made you want to close this tab, that's fair. Setting up a production-ready AI agent server is real work.

That's literally what we do. We'll take a Mac Mini (yours or one we ship you), configure everything in this guide plus custom skills for your specific workflows, and hand you back a running AI agent. $999, done in a day.

Book a call if you want the Mac Mini experience without the Mac Mini headache.

Related Reading

Get Your AI Agent Running

We handle the entire setup — deploy, configure, and secure OpenClaw so you don't have to.

  • Fully deployed in 48 hours
  • All channels — Slack, Telegram, WhatsApp
  • Security hardened from day one
  • 14-day hypercare included

One-time setup

$999

Complete setup, no recurring fees