Blog· OpenClaw·

How to secure OpenClaw on a Mac mini: a step-by-step hardening guide

Harden OpenClaw on a Mac mini: run its security audit, keep the Gateway private behind a token, pair chat senders, limit commands and protect your API keys.

A red robotic crab on a silver Mac mini, next to a large glossy violet shield with a padlock

OpenClaw is an AI agent that can run commands, read files and answer chat messages on the Mac where its Gateway lives. That is why securing it matters: whoever can reach the Gateway or message the agent can ask it to act.

OpenClaw’s defaults are conservative, and its documentation has a full security section. This guide walks through it in order, applied to a Mac mini that runs the agent around the clock. Every command and setting comes from OpenClaw’s official docs. If you haven’t installed OpenClaw yet, start with our guide to running OpenClaw on a cloud Mac mini.

Start with the security audit

OpenClaw ships its own audit command. Run it first, and again after every configuration change:

openclaw security audit

It reads your configuration and files and reports findings, each with an ID such as gateway.bind_no_auth. Two flags are worth knowing:

openclaw security audit --deep
openclaw security audit --fix

--deep adds a live check of the running Gateway. --fix applies a narrow set of safe repairs: it turns open group policies into allowlists and tightens permissions on OpenClaw’s state and config files. It does not rotate tokens, disable tools or change how the Gateway is exposed.

The docs also give the order to fix findings in: first anything open to strangers while tools are enabled, then network exposure, then remote browser control, file permissions and plugins.

Step 1: keep the Gateway private

The Gateway serves the agent’s WebSocket and the web dashboard on one port, 18789 by default. On a regular install it binds to loopback, so only programs on the Mac itself can connect. Check it:

openclaw config get gateway.bind

If the value was never set, the command says the default applies, and on a regular install that default is loopback.

Authentication is on by default too. Onboarding generates a Gateway token even for loopback, and without a valid auth path the Gateway refuses connections. If you need a new token, openclaw doctor --generate-gateway-token creates one, and the audit warns when a token has fewer than 24 characters. Treat it like an admin password: the docs describe it as full operator access to that Gateway.

The docs are direct about the rest: never expose the Gateway unauthenticated on 0.0.0.0, and avoid exposing it directly to the public internet. To use the dashboard from your own computer, forward the port over SSH, which the docs call the fallback that works from any machine. On a SoloRack Mac, take the SSH command shown in My account (it works once you’ve added your public SSH key there) and add the port forward:

ssh -p <port> -L 18789:127.0.0.1:18789 <user>@<host>

Then open http://127.0.0.1:18789 in your browser. The Gateway stays on loopback, and only your SSH key gets in.

One more setting for a Mac: on macOS hosts the Gateway announces itself on the local network through Bonjour. To switch that off, add this to your OpenClaw config (openclaw config file prints its path):

{ discovery: { mdns: { mode: "off" } } }

Step 2: choose who can message the agent

A chat channel is a door to the agent. The default DM policy, pairing, keeps it shut: an unknown sender gets an 8-character code, and their message isn’t processed until you approve it. Codes expire after one hour.

openclaw pairing list telegram
openclaw pairing approve telegram <CODE>

When no command owner is configured, the first approval from the CLI also makes that account the owner, allowed to use privileged commands and answer approval prompts.

The other policies are allowlist (unknown senders are blocked, with no code), disabled (DMs are ignored) and open (anyone can write), which is best left alone. For groups, keep the allowlist and require a mention, so the agent reacts only when called. If more than one person may DM the agent, the docs recommend isolating their sessions:

{ session: { dmScope: "per-channel-peer" } }

To see which devices are paired with the Gateway, run openclaw devices list; openclaw devices remove <deviceId> removes one you don’t recognize.

Step 3: limit what the agent can run

By default, OpenClaw runs commands on the host without asking: the docs call this the default for trusted-operator setups (mode=full). If you prefer guardrails, tools.exec.mode has five settings:

  • deny: no host commands at all.
  • allowlist: only allowlisted commands run.
  • ask: allowlisted commands run, and a human approves anything new.
  • auto: like ask, with an automatic reviewer before a human is asked.
  • full: no ordinary approval prompts.

The docs recommend auto for coding agents:

openclaw config set tools.exec.mode auto
openclaw approvals get
openclaw gateway restart

Afterwards, openclaw exec-policy show prints the effective policy.

Tool policy decides which tools the agent has at all. For any agent that handles untrusted content, the docs say to deny the control-plane tools:

{
  tools: {
    deny: ["gateway", "cron", "sessions_spawn", "sessions_send"],
  },
}

The hardened baseline in the docs adds two switches: tools.fs.workspaceOnly: true keeps the file tools inside the agent’s workspace, and tools.elevated: { enabled: false } closes the escape hatch that runs commands outside a sandbox.

Sandboxing is opt-in. Enabled under agents.defaults.sandbox, it moves tool execution into a container (Docker and Podman backends are built in) while the Gateway stays on the host. The docs say it is not a perfect boundary, but that it materially limits file and process access. Their minimal example:

{
  agents: {
    defaults: {
      sandbox: {
        mode: "non-main",
        scope: "session",
        workspaceAccess: "none",
      },
    },
  },
}

Step 4: treat what the agent reads as untrusted

Locking down DMs is not enough: a web page, an email, a document or a pasted log can carry instructions written for your agent. The docs call the content itself a threat surface, and list what helps:

  • Treat links, attachments and pasted instructions as hostile by default.
  • Keep web_search, web_fetch and browser off for tool-enabled agents unless you need them.
  • Let a read-only “reader” agent summarize untrusted content, then pass the summary to your main agent.
  • Keep secrets out of prompts.
  • Use a latest-generation, best-tier model for any agent that can run tools. Smaller models are easier to steer, so if you run a local model, pair it with read-only tools and a sandbox.

If you turn browser control on, give the agent a dedicated browser profile (the default openclaw profile), never one that is logged in to your personal accounts.

Step 5: protect secrets and API keys

The docs’ rule: assume anything under ~/.openclaw/ may contain secrets, from the config with the Gateway token to channel credentials, model logins and session transcripts. The folder should be 700 and openclaw.json 600; openclaw doctor warns and offers to tighten them, and openclaw security audit --fix does it too.

For API keys:

  • Put provider keys in ~/.openclaw/.env or in the config env block, not in a project’s .env. OpenClaw blocks provider credentials from workspace .env files on purpose.
  • Use the secret store for values the agent needs. openclaw secrets store set <NAME> asks for the value in a hidden prompt. The --value flag is refused for secrets, because arguments leak into shell history.
  • Run openclaw secrets audit --check to find secrets left in plain text.
  • When you share diagnostics, use openclaw status --all, which redacts secrets, instead of raw logs.

On a SoloRack Mac there’s one more protection: when your rental ends, your macOS account and all your files are erased, ~/.openclaw included, with no copies kept. Download what you want to keep before the end.

Step 6: grant macOS permissions with care

macOS guards screen recording, accessibility and personal folders through its privacy system. OpenClaw’s native tools ask only when they need a permission: a missing one stops the command with PERMISSION_MISSING, and the agent waits until you grant it. Over remote desktop, you can review them all in the OpenClaw app under Dashboard → Settings → This Mac → Permissions.

Three points from the docs:

  • Accessibility goes to the app, not to node. A grant to a shared node binary covers every script launched through it. Grant OpenClaw.app instead, and remove a stray node entry under System Settings → Privacy & Security → Accessibility.
  • Files stay in the workspace. macOS may gate Desktop, Documents and Downloads for background processes. Instead of granting folder after folder, the docs suggest moving files into ~/.openclaw/workspace.
  • Full Disk Access only when a feature asks. In the docs it comes up for the iMessage channel, which reads the Messages database. If nothing you use needs it, leave it off. Apple is also reworking this permission: see our article on Full Disk Access in macOS 27.3.

Step 7: vet skills and stay updated

Plugins run inside the Gateway process, and the docs say to treat them, and skill folders, as trusted code. Before installing one of the best OpenClaw skills from ClawHub, read its audit status (Pass, Review, Warn or Malicious), and check an installed skill with:

openclaw skills verify @owner/<slug>

Then keep OpenClaw current:

openclaw update
openclaw update status

The new version is prepared next to the running one, and if the new Gateway can’t start, the launcher restores the previous release.

If something looks wrong

The docs’ incident checklist is short: stop the Gateway (openclaw gateway stop), set risky channels to dmPolicy: "disabled", rotate the Gateway token and your provider API keys, read openclaw logs, then run openclaw security audit --deep and confirm the critical findings are resolved.

Why a dedicated Mac mini makes this easier

OpenClaw’s security model assumes one trust boundary per Gateway, ideally on its own host. A SoloRack Mac mini is exactly that: one customer per Mac, never a shared virtual machine, with full admin rights for you. The agent works on a Mac that holds only what you put there, far from your personal photos, passwords and browser sessions, and it stays on in the datacenter while your own computer is off.

Give your agent a Mac of its own

Rent a Mac mini M6 from SoloRack and run a locked-down OpenClaw on hardware nobody else uses: from $3.73 a day on the monthly plan, $112 a month, VAT included where it applies. The plan renews on its own until you turn renewal off in My account. All plans are on the pricing page.

Try SoloRack from ⁦$3.73⁩ a day

A dedicated Mac mini M6 on the monthly plan: ⁦$112⁩ a month. Prices in US dollars, VAT included where it applies.

Before you pay

The email you enter on the payment page becomes your account: you sign in to My account with that same address.

Payment is handled by Stripe through Link, its payment service: the payment page shows Link's name, and your bank statement will show LINK.COM* SOLORACK.

They show us how the site is used, including recordings of your visit; what you type stays hidden (PostHog, Google Analytics). These tools use cookies and start only if you say yes. You can change your mind at any time from the bottom of the page. If you say no to statistics, we only count your visit, without cookies. Cookie policy