Guide

Operating guide · Remote AI Agent

Mac mini as a persistent AI Agent server with phone remote access

Mac mini remote AI agent setup: control Codex, Claude Code, Hermes and OpenClaw from your phone using Tailscale, tmux, native apps and chat gateways.

Control Codex CLI, Claude Code, Hermes Agent and OpenClaw running on a Mac mini from your phone. The guide covers differences between the four tools, setup for three remote-access layers, security foundations and common problems reported by the community.

Reading time
14 min
Updated
Open original report
Difficulty
From scratch
Host
Mac mini (Apple Silicon preferred)
Device
iPhone / Android
Core tools
Tailscale + tmux
Updated
As of 5/2026

01Section

Operating architecture

The Mac mini is a persistent server where AI agents read and write files, run commands, modify code and execute tests. The phone provides an input/output interface without running AI computation: it sends instructions to the Mac mini and displays results or items awaiting confirmation. Compute resources and local files stay on the Mac mini.

Architecture limits and connection requirements:

  • Code is not uploaded to the cloud, giving clearer security and compliance boundaries than cloud-only tools.

  • Reconnect from anywhere while the Mac mini stays awake, the network is reachable and the session remains active.

  • Remote setup must provide secure connections and keep sessions alive after disconnection.

Remote AI Agent architecture
  1. Phone

    Thin client

    • Send prompts · View output
  2. Tailscale encrypted channel (WireGuard)

    No public ports · Private mesh VPN

  3. Mac mini (persistent Agent server)

    tmux / screen keeps sessions alive after disconnection

    • Claude CodeRemote Control
    • CodexCLI + Mac App
    • Hermes AgentMessaging gateway
    • OpenClaw 🦞Messaging gateway

Phone → (Tailscale channel) → tmux session on Mac mini → (four agents execute work)

02Section

Remote access for four tools

The four tools have different roles and phone access paths.

ToolRolePhone remote accessSetup difficulty
Claude CodeAnthropic's terminal coding agent, running on the user's machine and operating on local files.Built-in Remote Control (since 2026/2, research preview, available on all plans). Use the official Claude App or claude.ai/code to control the same local session.★ Easiest
CodexOpenAI's coding agent, available as CLI, IDE extension and macOS App.Integrated into ChatGPT App (since 2026/5, preview). Phone setup must start from Codex Mac App; it cannot start from CLI or an IDE extension.★★ Setup restrictions
Hermes AgentNous Research's self-hosted autonomous agent, with unrestricted model choice, skill creation and persistent memory.Built-in messaging gateway: connect a bot to 20+ platforms, including Telegram / Discord / Slack / WhatsApp / Signal / iMessage. Send messages in your chat app to issue instructions.★★ Moderate
OpenClaw 🦞Peter Steinberger's personal AI assistant (formerly Clawdbot / Moltbot), running locally and able to coordinate other agents.Uses chat channels (WhatsApp / Telegram / iMessage and others); Tailscale Serve / Funnel can expose a remote dashboard. Can call Claude Code and Codex CLI as tools.★★ Moderate

03Section

Layer 0: Foundation setup

Complete these four settings before choosing a remote access method. Failed phone connections or lost sessions usually come from incorrect setup at this layer.

Foundation · One-time setup

Sleep, SSH, VPN networking and persistent sessions

1 Mac mini sleep settings

All background sessions terminate when the Mac mini sleeps. In System Settings → Energy Saver, disable automatic sleep and enable the option to prevent the computer from sleeping automatically. For temporary use:

bash
# 讓機器在這個指令存在期間都不睡(含磁碟與顯示器)
caffeinate -dimsu

2 Remote Login (SSH) setup

Enable System Settings → General → Sharing → Remote Login. This is required for terminal-only methods and Tailscale SSH.

3 Tailscale private mesh network

Tailscale uses WireGuard to create a private mesh network between devices. Each machine gets a fixed 100.x.x.x IP, reachable from home, office or mobile networks without opening public ports. Install Tailscale on the phone and sign in with the same account.

bash
# 在 Mac mini 上
brew install tailscale          # 或從 Mac App Store 裝 GUI 版
sudo tailscale up --ssh         # --ssh 讓你免管金鑰、用 Tailscale 身分登入
tailscale ip                    # 記下這個 100.x 的 IP

4 tmux persistent sessions

Without tmux, ongoing agent work terminates when the phone locks, the network drops or SSH disconnects. tmux keeps the session running in the background so reconnection restores the original screen and work state.

bash
brew install tmux
tmux new -s agent               # 開一個叫 agent 的 session
# 在裡面啟動 claude / codex / hermes …
# 要離開但不關掉:按 Ctrl+B 再按 D(detach)
tmux attach -t agent            # 下次重連,接回原本的畫面
tmux ls                         # 列出所有還活著的 session

04Section

Layer 1: Official native remote access

Claude Code and Codex have official remote access methods with dedicated Apps, screen synchronization and push notifications. They require no additional command-line network setup.

Claude Code · Remote Control

Claude App connection to a local session

Anthropic introduced Remote Control in 2026/2. The session runs entirely on the Mac mini, with the phone or browser as another input/output interface; local files, settings and MCP servers stay on the machine. Instructions, output and tool actions synchronize across devices in real time.

1 Remote access activation on Mac mini

Choose one of three startup methods:

bash
claude remote-control            # 伺服器模式
claude --remote-control          # (或 --rc)開一個已開遠端的互動 session
# 或在既有 session 裡輸入斜線指令:
/remote-control                  # 會把目前 session 連同對話歷史轉成可遠端

After startup, the terminal displays a session URL. Press Space to show a QR code for phone connection. First use /rename to give the session an identifiable name.

2 Phone connection

  • If the App is not installed, enter /mobile in Claude Code to display an iOS / Android download QR code.

  • Sign in to Claude App or claude.ai/code with the same account and organization.

  • The Code tab shows "Remote Control Session (Mac)" with a computer icon and green dot when online.

  • Alternate instructions between terminal, browser and phone; the conversation stays synchronized.

3 Push notification activation

With remote access enabled, Claude can send phone notifications when a long task completes or a decision is needed. Request notifications in the prompt, for example "Notify me when the tests finish"; install the phone app and enable "Push when Claude decides" through /config in the terminal. Push requires Claude Code v2.1.110 or later, and the phone app must have been opened once to register its push token.

Codex · ChatGPT Mobile

Codex mobile setup and restrictions

OpenAI added Codex remote access to the ChatGPT mobile App on 2026/5/14 (iOS / Android, preview, all plans including Free / Go). Once connected, the phone loads the host's live state; continue existing conversations, inspect output, approve commands, switch models or start new tasks.

1 Codex Mac App installation and updates

  • Update Codex App on macOS and ChatGPT App on the phone.

  • Sign in with the same account and workspace; a ChatGPT workspace may require an administrator to enable Remote Control permissions.

2 QR code pairing

  • Select "Set up Codex mobile" in the Codex App sidebar to display a QR code.

  • Scan it with ChatGPT App on the phone to pair. The host must stay awake, online and signed in to the same account.

05Section

Layer 2: Messaging gateway agents

Hermes and OpenClaw connect agents to chat platforms without a dedicated remote access App. Send instructions through existing tools such as Telegram, WhatsApp or iMessage; text and voice input are supported.

Hermes Agent · Nous Research

Agent control through chat platforms

Hermes Agent is a self-hosted autonomous agent with unrestricted model choice. It stores successful workflows as reusable skills and persists memory and sessions in SQLite. Its gateway supports more than 20 platforms, including Telegram, Discord, Slack, WhatsApp, Signal, Matrix and iMessage (through BlueBubbles), sharing an agent instance and session routing across platforms.

1 Installation, model and backend configuration

bash
# 安裝後設定(檔案都放在 ~/.hermes 底下)
hermes config set model anthropic/claude-opus-4.6
hermes config set terminal.backend ssh   # local / docker / ssh 等多種後端

hermes --tui                              # 推薦的現代 TUI 介面

Hermes requires a model with at least 64K context for multi-step tool calls. Its SSH / local backend preserves shell state: cd, environment variables and aliases stay effective in the same session. Built-in cron scheduling can send results to any platform.

2 Chat-platform entry point

  • For Telegram, obtain a token from BotFather, add it to Hermes gateway settings and start the gateway.

  • Send text or voice notes to the bot from your phone to issue instructions; Hermes supports voice.

  • It runs on the Mac mini, with connections restricted to the private Tailscale network; the user manages the security boundary.

OpenClaw 🦞 · Peter Steinberger

Local personal assistant and agent orchestration

OpenClaw (formerly Clawdbot / Moltbot) is a personal AI assistant running on a local device. It responds through existing messaging channels, including WhatsApp, Telegram, Slack, Discord, iMessage and Signal. Its control plane is a local gateway (ws://127.0.0.1:18789).

1 Guided setup

bash
openclaw onboard   # 一步步帶你設定 gateway、workspace、頻道、技能

2 Two phone access methods

  • Chat channels: connect Telegram / WhatsApp / iMessage or another channel and send messages to issue instructions.

  • Tailscale Serve / Funnel: provides remote gateway dashboard and WebChat access through Tailscale for the phone browser.

3 Agent coordination layer

Community OpenClaw configurations, such as TechNickAI's openclaw-config, add persistent memory, skills and autonomous scheduled workflows. The /fleet command manages multiple remote OpenClaw instances from one host. Advanced setups orchestrate callable tools such as Claude Code and Codex CLI; OpenClaw receives instructions and dispatches work to multiple agents.

06Section

Layer 3: Terminal-only SSH fallback

SSH with tmux can control any tool on the machine, including the four agents above. Use it when official Apps or gateways are unavailable.

SSH + tmux · General fallback

Phone-terminal Tailscale connection and session recovery

Install an SSH or mosh terminal App on the phone, connect to the Mac mini through Tailscale, run tmux attach to rejoin an existing session, then enter claude, codex or hermes. tmux keeps work in the session running when the phone locks or the connection drops.

1 Phone terminal App selection

  • Termius: cross-platform, with a user-friendly interface and simple setup.

  • Blink Shell: an iOS terminal option with mosh support and stable reconnection.

  • Moshi: designed for Claude Code and CLI agents, with mosh and tmux integration, a dedicated Ctrl+B button and a tmux shortcut panel.

2 Connection and session recovery

bash
# 從手機終端機,透過 Tailscale IP 連入
ssh your-user@100.x.x.x

# 接回先前開好的 agent session
tmux attach -t agent

# 直接在裡面啟動/續用任一 agent
claude            # Claude Code
codex             # Codex CLI
hermes --tui      # Hermes

07Section

Method selection

Select methods for the use case. They can be combined as needed.

Scenario · Primarily coding

Claude Code Remote Control

For screen synchronization and push notifications without additional network setup. Control the local session directly through the official Claude App.

Scenario · Primarily ChatGPT

Codex through Mac App + ChatGPT

If Codex is your main tool, install Codex Mac App on the Mac mini. Phone setup must start from Mac App.

Scenario · Instructions through chat

Hermes / OpenClaw chat gateways

For instructions through Telegram or voice messages, or persistent monitoring, scheduling and cross-platform notifications.

Scenario · General control or emergency access

SSH + tmux fallback

Use when official Apps are unavailable, tools lack a phone interface, or maximum control flexibility is required.

08Section

Community-reported problems and operating advice

This section draws on public Reddit (r/ClaudeAI, r/LocalLLaMA), Hacker News and practitioner posts. It covers common problems and responses not clearly explained in official documentation.

▲ Most common problem · r/ClaudeAI · Lost session

Mac sleep, failed connections and lost sessions

All background sessions terminate when the Mac mini sleeps. Disable automatic sleep in system settings or keep it awake with caffeinate -dimsu. The second most common cause is not using tmux, so work terminates after SSH disconnects.

▲ Security advice · r/LocalLLaMA · Remote connection security

Tailscale private networking and public-port restrictions

Restrict connections to the private Tailscale mesh network for end-to-end encrypted phone-to-host traffic without exposed public ports. ngrok can support temporary demonstrations; it is unsuitable for routine remote access.

▲ Mobile input · Practitioner reports · Reducing input friction

Phone speech-to-text and Quick Actions

Mobile input is less efficient. Use system speech-to-text; Hermes and OpenClaw both support voice messages. Save common commands as Quick Actions or snippets for one-tap sending; Apps such as Moshi and Remote Control provide this feature.

▲ Prompt writing · r/ClaudeAI · Harder to correct remotely

Detailed remote instructions

Phone operation makes immediate intervention harder. Specify the validation method, required pages and protected route, instead of vague instructions such as "Add login". Split large features into smaller steps and execute them separately.

▲ Common setup issue · Official documentation · Codex setup problems

Mobile setup differences between Codex CLI and Codex App

Phone remote setup can start only from Codex macOS App; CLI and IDE extensions cannot initiate it. If CLI alone cannot establish a phone connection, install Mac App or control CLI through SSH or a gateway.

▲ Long-task management · Multiple sources · Push notifications

Push activation and completion notifications

Claude Code can send push notifications when long tasks finish or confirmation is needed. Include "Notify me when the tests finish" in the prompt. This requires v2.1.110 or later and opening the phone app first to register its push token.

▲ Advanced setup · r/LocalLLaMA · Approval management

Trusted-command allowlists and server permissions

Use allowlists or automatic approval for trusted commands to reduce manual confirmations; Hermes has an approval system that learns preferences. On a server running 24 hours a day with access to all local files, use options that disable all permission confirmations cautiously. Prefer Docker backend isolation for high-risk work.

▲ Tool roles · Community consensus · Combined use

Recommended division of work

Claude Code handles code work (IDE integration and large-context tasks); Hermes or OpenClaw is the persistent assistant and coordination layer (monitoring, scheduling, cross-platform notifications and voice input); SSH is the fallback. Use these methods together.

09Section

Quick reference: Foundation commands

Complete these settings on the Mac mini as the foundation for all four remote methods.

① Mac mini foundations (one-time setup)

Foundation · prevent-sleep + ssh + tailscale + tmux

bash
# 工具
brew install tmux tailscale

# 私有網路(記下印出的 100.x IP)
sudo tailscale up --ssh
tailscale ip

# 系統設定手動處理兩件事:
#   能源 → 防止自動睡眠
#   一般 → 共享 → 遠端登入(SSH)打開

# 開一個常駐 session 養著 agent
tmux new -s agent

② Remote switches for each agent

Start the required agent inside a tmux session.

bash
# Claude Code:開遠端,手機/瀏覽器接管
claude --remote-control          # 或於 session 內 /remote-control;/mobile 取得 App QR

# Codex CLI:直接互動;手機原生遙控需另裝 Codex Mac App 設定
codex

# Hermes:接聊天平台當入口
hermes --tui

# OpenClaw:引導式設定頻道與技能
openclaw onboard

③ Phone connection and session recovery

Install Tailscale + a terminal App (Termius / Blink / Moshi) on the phone, or use the tools' official Apps / chat bots.

bash
ssh your-user@100.x.x.x
tmux attach -t agent             # 接回畫面,繼續工作

Content and design: Tenten

This guide reflects 2026/5, drawing on official documentation and public Reddit and Hacker News posts. Tools continue to change; features such as Claude Code Remote Control and Codex mobile remain in research preview, so consult current official documentation. Users must complete login, payment and permission authorization on their own devices.