All guides
macOS Agent

Set up an agent on a Mac

A Mac mini, or any Mac that stays on at the site, can be the agent. Download the app and click through it, or paste one line into Terminal — both end up at the same place.

Before You Start

  • You need a MikRouter account with at least one agent created under Agents.
  • Open the agent's detail page and keep its token and tunnel host nearby — you'll paste them into the app.
  • A Mac running macOS 11 Big Sur or newer, on the same network as the devices you want to reach.
  • You need to be able to enter an administrator password on it once, if you set up the background service — the Terminal route always does, and the app route offers it as an optional last step.

What you are installing

One program — no Homebrew, no Python and no other runtime. It connects on its own as soon as it has your tunnel host and device token.

Separately, it can register a background service that starts with the Mac and keeps running after you log out, so nobody has to stay signed in. Downloading the app leaves that up to you (it is the last step, and optional); the Terminal route sets it up for you as part of the install, along with the menu bar item and the mikrouter-agent command in /usr/local/bin.

1

Download and unzip it

The download is a zip so the licence and setup notes travel with the program. Double-click it in Downloads to unpack, which gives you MikRouter Agent.app. You do not have to move it into Applications yourself — installing does that for you in step 4.
2

Open it — right-click, then Open

Anything downloaded through a browser is quarantined by macOS, so a plain double-click is refused the first time. Right-click (or Control-click) MikRouter Agent.app, choose Open, then confirm. You only do this once.

If macOS still refuses

Open System SettingsPrivacy & Security and scroll to the bottom, where the app appears just after you tried to open it — choose Open Anyway. This happens because the build is not code-signed yet; the Terminal tab is not affected by it at all, because a file fetched with curl is never quarantined.
3

Enter the tunnel host and device token

The settings window opens straight into its fields — no sign-in and nothing to accept. Copy both values from your agent's page in the MikRouter dashboard, paste them into Tunnel host and Device token, then choose Save followed by Start Tunnel. Leave Tunnel port at 443 and Use TLS (wss) ticked unless your dashboard shows different values.
MikRouter Agent

Not set up yet

Fill in the tunnel host and the device token, then choose Start Tunnel. Installing the background service is optional, and is what keeps the tunnel up after you log out.

TUNNEL CONNECTION

Tunnel hoste.g. test.mikrouter.com
Tunnel port443Use TLS (wss)
Device token48 hexadecimal characters from the dashboard
Maximum streams64

1–1024 simultaneous tunnelled connections (default 64). One web page can use several. Raising this uses more memory and sockets; it does not add mappings or make the connection faster.

STARTUP

BACKGROUND SERVICE

Not installed

Install as a Background Service

The tunnel can run without any of this — Start Tunnel connects straight away, for as long as this app is open. The background service is what keeps it up when the app is closed: it starts with this Mac, before anyone signs in, and keeps running after you log out. Installing it needs administrator rights.

ABOUT

Version 1.0.0 (macos agent)

macOS 15.5 Mac mini (arm64)

Settings: /Users/you/Library/Application Support/MikRouter Agent/config.json

Log: /Users/you/Library/Application Support/MikRouter Agent/agent.log

For more info visit https://mikrouter.com

SaveStart TunnelHideQuit
FieldValue
hosttest.mikrouter.com
port443
tlstrue
token<your agent token>

test.mikrouter.com is not a real address — it's a stand-in for this guide. Your agent's real tunnel host depends on the agent server you picked when you created the agent, so copy the exact value from the agent's detail page rather than typing the one shown here.

4

Confirm the agent is Online in the dashboard

Open Agents and pick the agent. Within a few seconds its badge turns Online and the Agent section fills in with what the Mac itself reports — its macOS version and model, LAN IP, available RAM and agent version.
https://mikrouter.com/user/agents/…

Front Desk Mac

macOS 15.5 Mac mini (arm64)Online
Last seen just now✎ Edit agent

Agent

Live status reported by the agent — only while it's online.

Server Manila · test.mikrouter.com

Hardware

macOS 15.5 Mac mini (arm64)

Wi-Fi network

Wi-Fi signal

IP address

192.168.1.100

Firmware

v1.0.0

RAM available

9.4 GB

Active streams

0 / 64

Connected

just now

It is already working at this point

The tunnel runs inside this app — the window says so — so the agent connects straight away, with nothing installed. Step 5 explains the optional background service, which is what makes it survive quitting the app, logging out and restarting.
5

Install it as a background service — optional

You can stop here. The agent is connected and you can start adding mappings. This step is worth doing when the Mac is meant to stay reachable on its own — and you can come back to it at any time.

What the background service actually is

Right now the tunnel is running inside the app. That means it lives and dies with the app: quit it, log out, or restart the Mac, and the tunnel goes with it. Nothing is broken about that — it just needs somebody signed in with the app open.

The background service moves the tunnel out of the app and into macOS itself, as a LaunchDaemon — a program macOS starts at boot, before anyone logs in, and keeps running after everyone logs out. The window then stops being the thing that holds the tunnel up and becomes just a remote control for it: you can close it, quit it, or sign out entirely and the tunnel carries on.

So do you need it?

Install it for anything you are leaving in place — a Mac mini at the site, or any machine that has to come back on its own after a power cut or a restart. Without it, a reboot leaves the agent offline until someone signs in and opens the app.

Skip it if you are trying MikRouter out, or using a Mac you are sitting at anyway and do not mind restarting the tunnel yourself.

To install it: in the STARTUP section choose Install as a Background Service and enter your administrator password when macOS asks — it needs one because a program that starts before login is a system-wide change. Your saved settings are carried over, so nothing is retyped. Afterwards the row reads Installed — the tunnel starts with this Mac, the app is copied into Applications, and a MikRouter item appears in the menu bar.

MikRouter Agent

Connected to test.mikrouter.com:443

0 of 64 streams in use · LAN address 192.168.1.100

TUNNEL CONNECTION

Tunnel hosttest.mikrouter.com
Tunnel port443Use TLS (wss)
Device token0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x
Maximum streams64

1–1024 simultaneous tunnelled connections (default 64). One web page can use several. Raising this uses more memory and sockets; it does not add mappings or make the connection faster.

STARTUP

BACKGROUND SERVICE

Installed — the tunnel starts with this Mac

Uninstall the Background ServiceStop the Background Service

The tunnel can run without any of this — Start Tunnel connects straight away, for as long as this app is open. The background service is what keeps it up when the app is closed: it starts with this Mac, before anyone signs in, and keeps running after you log out. Installing it needs administrator rights.

ABOUT

Version 1.0.0 (macos agent)

macOS 15.5 Mac mini (arm64)

Settings: /Library/Application Support/MikRouter Agent/config.json

Log: /Library/Application Support/MikRouter Agent/logs/agent.log

For more info visit https://mikrouter.com

SaveStop TunnelCheck for UpdatesHideQuit

Installed. The tunnel now starts with this Mac and keeps running after you log out.

The agent is connected — what's next

Nothing is reachable from the internet yet. That happens when you add mappingson the agent's detail page, one per LAN service you want to reach. It works the same for every kind of agent — the Connect ESP32 agent guide covers it.