Easy Secure Setup of OpenClaw on a Mac Mini

Setup OpenClaw on a Mac Mini with good enough security that doesn’t decapitate your agent.
Author

Will James

Published

February 21, 2026

OpenClaw Mac Mini hardening

The Step by Step Guide You Have Been Looking For

This guide is for you if you want to run OpenClaw on a Mac Mini with security that will protect the Mac from outside attack and OpenClaw itself, without decapitating the magic ability of OpenClaw to run autonomously. What this guide does differently than many other guides I reviewed before deciding to write my own:

  1. Keep it simple to important security configurations
  2. Provide precise detailed steps for configurations and commands that need to be run.

A lot of guides say to install xyz or configure some setting - but leave out the HOW. This guide gives you every detail while keeping things as simple as possible.

Here are the steps you will go through:

Key steps (overview)

1. Getting Ready

2. Setting up Mac Mini Users

Plugin and startup your Mac Mini and start following the setup. You are going to use the first gmail account for the admin user to do the initial setup of the device.

3. Install Dependency: Homebrew & npm setup

Execute these steps as the Mac Mini admin user.

This is some software you will need to install OpenClaw. It is also referenced in configuring the Mac Mini Firewall, so we should install it early to make other settings easier to complete in single steps.

Open up the Terminal application and start running these commands:

# Install Homebrew (follow post-install steps to add brew to PATH if prompted)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Node (for firewall allow list and npm — provides /opt/homebrew/bin/node)
brew install node

# Create a directory for user-local global packages
mkdir ~/.npm-global

# Configure npm to use this prefix (for all future -g installs)
npm config set prefix '~/.npm-global'

# Add the bin path to the admin user's shell PATH (zsh is default on macOS)
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Repeat the following configurations as the non-admin user

Log in as the non-admin user and run:

  • # Add Homebrew's bin to PATH (so the non-admin can run node and npm)
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
    source ~/.zshrc
    
    # Create a directory for user-local global packages
    mkdir ~/.npm-global
    
    # Configure npm to use this prefix (for all future -g installs)
    npm config set prefix '~/.npm-global'
    
    # Add the npm global bin path to non-admin user's shell PATH
    echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc

4. Remote Access your Mac Mini

Execute these steps as the Mac Mini admin user.

In this section you will configure the Mac Mini firewall and sharing settings to allow only the minimum required remote access.

Firewall Configuration

Go to System Settings > Network > Firewall

Go to System Settings → Network → Firewall → Options

Allow incoming connections

Do NOT allow other apps/services (e.g. cupsd, smbd, python3) unless you need them — set any that appear to Block or remove them.

Node does not appear by default, it is a command-line binary (not a .app), so it must be added manually:

  1. In Firewall Options, click + (opens file browser).
  2. Press Command + Shift + G (Go to Folder).
  3. Enter: /opt/homebrew/bin/node (standard Homebrew path on Apple Silicon; run which node as the non-admin user to confirm).
  4. Select node → Open/Add, then set it to Allow incoming connections.

Result: Node processes (e.g. OpenClaw gateway on port 18789) can accept incoming connections when bound to an interface. Prefer binding servers to 127.0.0.1 or the Tailscale IP in config, and use Tailscale/pf for access control.

Additional Firewall Settings

Sharing Configurations

Go to System Settings > General > Sharing

Remote Management and Screen Sharing

Remote Management provides screen sharing over VNC (port 5900); the Screen Sharing toggle in Sharing is intentionally left off — Remote Management passes along the rights and controls access.

Remote Login (SSH)

Go to System Settings → General → Sharing → Remote Login

Restrict SSH to key-based auth

I am using password based ssh access because I use multiple computers around the house and dont want to manage so much key distribution. Key setup is more complexity. I would suggest getting basic password signin working and then add key auth if you really want it.

Other apps

5. Setup Tailscale

We will use Tailscale to further lock down access to the Mac Mini. This part will take you through getting it setup on the Mac and any remote machine you use to access the Mac.

Execute these steps as the Mac Mini admin user.

Install Tailscale on the Mac Mini

The Mac Mini is added to your tailnet automatically; no separate “add device” step is needed.

Install Tailscale on your remote machine

The remote machine is now on the same tailnet.

Verify both devices are online (MagicDNS)

Configure access control (ACLs + tagging)

Use the Tailscale admin console to lock down who can reach the Mac Mini. Ensure Remote Login is enabled on the Mac Mini (System Settings → General → Sharing → Remote Login) before testing.

Create / confirm the tag and owner (Access control → Tags sub-tab):

    • Tag: tag:openclaw-one-host
    • Owners: autogroup:admin
    • Note: “Only admin can assign this tag.”

Assign the tag to the Mac Mini (Machines tab):

Find the Mac Mini at https://login.tailscale.com/admin/machines

Create / confirm these two rules in General access rules:

    • Source: autogroup:member
    • Destination: autogroup:self
    • Ports: *
    • Note: “Allow members to access their own devices.”
    • Source: autogroup:admin
    • Destination: tag:openclaw-one-host
    • Ports: tcp:22, tcp:5900 (add more as needed, one per line)
    • Note: “Admin access to OpenClaw host only.”

Test SSH and Remote Management over Tailscale

Test from your remote machine:

Block LAN SSH/VNC using pf (Tailscale-only)

Execute these steps as the Mac Mini admin user.

We are going to further lock down SSH and Remote Management access to the Mac Mini to make full use of Tailscale access control. These configurations blocks direct access from the local LAN (192.168.x.x) but allows SSH over Tailscale (MagicDNS or Tailscale IP).

Goal: - Remote Login = ON (sshd must run for Tailscale SSH forwarding) - Direct LAN (192.168.x.x) SSH (port 22) and Remote Management (port 5900) blocked - Tailscale SSH and Remote Management allowed

Prerequisites - Remote Login is already ON in System Settings > General > Sharing

Step-by-Step Commands (run as admin user — <macmini-admin-user>)

  1. Create the custom pf rules file (blocks LAN, allows Tailscale):

    Edit the file /etc/pf.tailscale-ssh.conf

    Paste exactly:

    # Block incoming SSH (22) and VNC (5900) from local LAN on Wi-Fi/Ethernet interfaces
    block in on { en0 en1 } proto tcp to any port { 22 5900 }
    
    # Allow SSH and VNC from Tailscale range on Tailscale interface
    pass in on utun* proto tcp from 100.64.0.0/10 to any port { 22 5900 }
  2. Set correct permissions on the file:

    sudo chown root:wheel /etc/pf.tailscale-ssh.conf
    sudo chmod 644 /etc/pf.tailscale-ssh.conf
  3. Make pf load this file on boot (add include to main config):

    Edit the file /etc/pf.conf

    Add this line at the end:

    include "/etc/pf.tailscale-ssh.conf"
  4. Load and enable the rules now (applies immediately):

    sudo pfctl -e -f /etc/pf.conf
  5. Verify the rules are loaded:

    sudo pfctl -sr
    • You should see the block and pass lines for port 22 and 5900.
  6. Test paths:

    # Tailscale SSH (should work)
    ssh <openclaw-user>@<macmini-computer-name>
    # or
    ssh <openclaw-user>@<tailscale-ip>
    
    # Local LAN SSH (should fail — expected: connection timed out or refused)
    ssh <openclaw-user>@192.168.x.x
  7. Reboot and re-verify (confirms persistence): Reboot the Mac Mini, then run:

    sudo pfctl -sr
    • Rules should still be loaded.
    • Retest both SSH paths.

Undo / Disable if Needed

#Disable pf completely (temporary):
sudo pfctl -d

#Remove permanent include (edit /etc/pf.conf and delete the line, then reload):
sudo pfctl -f /etc/pf.conf

This is the standard, built-in way to restrict SSH to Tailscale on macOS without third-party tools or disabling Remote Login.

Disable Screen Lock

Once you have all the remote access setup, if you plan to run the Mac Mini headless (no monitor/keyboard/mouse attached), turn off the GUI lock/sleep behavior so the Mac Mini doesn’t lock you out of screen share by invoking sleep.

    • Start screen saver when inactive: Never
    • Turn display off when inactive: Never
    • Require password after screen saver begins or display is turned off: Never

Access OpenClaw Gateway via SSH tunnel

In the next step you will install OpenClaw and its gateway. With remote accesa available you can access the OpenClaw gateway remotely using an SSH tunnel. Try this out after you complete OpenClaw install:

  • ssh -N -L 18789:127.0.0.1:18789 <openclaw-user>@<macmini-computer-name>
  • http://127.0.0.1:18789/?token=<gateway token>

    Replace <gateway token> with your actual OpenClaw gateway token.

Note: You must keep the SSH tunnel session running while accessing the gateway.

6. Install OpenClaw

Execute these steps as the Mac Mini OpenClaw non-admin user.

Handling installation permissions for non-admin users

When running the OpenClaw installer as a non-admin user on macOS with Homebrew (typically installed by an admin), the script can fail during the global npm install phase with errors like “npm install failed; cleaning up and retrying…” or EACCES (permission denied) — npm writes to system directories (e.g. /opt/homebrew/lib/node_modules) owned by the admin, and openclaw --version may show “command not found.” This is a standard macOS/npm quirk, not an OpenClaw bug. The admin user must complete section 3 (Homebrew & npm setup) first so the non-admin user has a user-local global prefix (~/.npm-global) and openclaw is available in PATH.

Run the installer

  • curl -fsSL https://openclaw.ai/install.sh | bash

7. Move OpenClaw secrets from openclaw.json to .env

Execute these steps as the Mac Mini OpenClaw non-admin user.

By default the OpenClaw installer and config tool writes API keys directly into openclaw.json. This step moves those keys into the .env file so that openclaw.json contains only env var references and can safely be tracked in git without leaking secrets. If you setup a model API key like OpenAI API, then OpenClaw created a .env for you and put it there. Otherwise create it for yourself.

Add keys to .env

OPENAI_API_KEY=sk-...
OPENCLAW_GATEWAY_TOKEN=...
TELEGRAM_BOT_TOKEN=...
# Add any other keys you need here, one per line
chmod 600 ~/.openclaw/.env

Update openclaw.json with env references

  "channels": {
    "telegram": {
      "enabled": true,
      "dmPolicy": "pairing",
      "botToken": "${TELEGRAM_BOT_TOKEN}",
      "allowFrom": [],
      "groupPolicy": "disabled",
      "streamMode": "partial"
    }
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",
      "token": "${OPENCLAW_GATEWAY_TOKEN}"
    },

Note: The OPENAI_API_KEY is already recognized inside OpenClaw and does not need to go into openclaw.json.

Final Thoughts

If you followed these steps the Mac Mini should be in good shape for running OpenClaw in a secure but practical way. OpenClaw has dramatic autonomy in this setup and theoretically its Mac user could be compromised, but the machine is hardened from the agent application. This setup is to max autonomy and not get totally pwned. Like all OpenClaw admins you’ll have to watch out for possible prompt injections but that goes along with generally keeping an eye on the agent, so is not that special.

Something to think about after you get going is setting up some kind of backup of projects and data from the machine. Like having photos on a phone, you probably want to think about backups of your agent after you get it working.