Back to Articles

How to Use Claude Code on iPhone: The Best Remote Coding Setup for AI Agents

The complete guide to running AI coding agents from your phone with mosh, tmux, Tailscale, and push notifications

How to Use Claude Code on iPhone: The Best Remote Coding Setup for AI Agents

How to Use Claude Code on iPhone: The Best Remote Coding Setup for AI Agents

The complete guide to running AI coding agents from your phone with mosh, tmux, Tailscale, and push notifications


TL;DR: Use Tailscale for networking, mosh+tmux for resilient sessions, and Moshi as your iOS terminal app. Get push notifications when your AI agent needs input, approve from anywhere, keep coding.


Want to use Claude Code from your iPhone? Monitor GitHub Copilot agents remotely? Approve Cursor background tasks while away from your desk?

AI coding agents like Claude Code, GitHub Copilot Coding Agent, and Cursor Background Agents can implement features, fix bugs, and create pull requests autonomously. But they still need human judgment for:

  • Permission to run destructive commands
  • Architectural decisions
  • Access to sensitive files
  • Disambiguation when requirements are unclear

Your agent is only as productive as your availability. This guide covers the essential stack for staying connected from anywhere.


The Stack

LayerToolPurpose
NetworkTailscale / WireGuardSecure access to your dev machine
ConnectionmoshResilient mobile shell
SessiontmuxPersistent sessions + scrollback
TerminalMoshiNative iOS terminal with push notifications

Each layer solves a specific problem. Skip one, and the whole setup breaks down.

┌──────────────────┐
│   Dev Server     │  mosh + tmux + AI agent
│   Always On      │  Runs 24/7
└────────┬─────────┘
         │ Push notification
         ▼
┌──────────────────┐
│     iPhone       │  Moshi app
│                  │  Approve & continue
└──────────────────┘

Connect to Your Dev Server from Anywhere (Tailscale / WireGuard)

Before you can SSH from your iPhone to your dev machine, you need a way to reach it. If your server is behind NAT, a firewall, or a corporate network, direct SSH isn't possible.

Why You Need a Mesh VPN

Tailscale builds on WireGuard to create a peer-to-peer mesh network. Every device gets a stable IP address that works from anywhere—home, office, coffee shop, cellular.

From a Hacker News discussion:

"SSH running on top of Wireguard / Tailscale is way more usable than before. Those tools address the roaming IP issues directly at the network layer."

Tailscale Setup

# Install via Homebrew
brew install tailscale

# Enable SSH access
sudo tailscale up --ssh

# Get your Tailscale IP (e.g., 100.64.0.1)
tailscale ip

Now your Mac is accessible from any device on your tailnet—even from cellular networks behind carrier-grade NAT.

Tailscale SSH eliminates key management entirely. Permissions are managed as code in your ACLs.

Alternative: Raw WireGuard

If you prefer self-hosting, WireGuard gives you the same benefits with more control. The tradeoff is manual key management.


Why mosh Is Better Than SSH for Mobile (iPhone/iPad)

SSH over unreliable networks is painful. Change WiFi networks, switch to cellular, or let your phone sleep—and your session dies.

Mosh (Mobile Shell) was built for mobile connections.

mosh vs SSH

According to the mosh research paper, on a link with 29% packet loss, mosh reduced average response time from 16.8 seconds to 0.33 seconds—a 50x improvement over SSH.

  • Roaming: Survives WiFi → cellular → WiFi transitions
  • Instant echo: 70% of keystrokes predicted locally, sub-5ms response
  • No frozen sessions: UDP-based protocol handles packet loss gracefully
  • Always responsive: Ctrl+C always works, even on congested networks

The Scrollback Problem

Critical: mosh has no scrollback buffer.

From GitHub issue #122:

"Mosh's terminal scrollback buffer is incomplete because Mosh synchronizes only the visible state of the terminal."

Run ls -la on a large directory, and the overflow is gone. You can't scroll up.

The solution: always use mosh with tmux. Mosh handles the connection. Tmux handles the scrollback.

Installing mosh

# macOS
brew install mosh

If you're using Tailscale or WireGuard, no firewall configuration is needed—you're already on a private network.


tmux for Persistent Remote Sessions

tmux creates persistent terminal sessions that survive disconnections—essential for remote development from your phone.

Why You Need tmux with mosh

  1. Persistence: Sessions survive network drops, phone sleep, and app switches
  2. Scrollback: Captures all output that mosh discards
  3. Multiplexing: Multiple windows and panes in one session
  4. Detach/attach: Start work on your laptop, continue on your phone

From the Princeton Handbook:

"If your SSH connection drops, the tmux session and its processes remain running on the server."

Essential Configuration

Create ~/.tmux.conf on your server:

# Scrollback buffer (default is 2000)
set -g history-limit 50000

# Mouse scrolling
set -g mouse on

# Pass window titles to terminal (for Moshi)
set -g set-titles on
set -g set-titles-string "#S:#W"

# Better prefix for mobile
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# Vim-style pane switching
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

Basic Commands

CommandDescription
tmux new -s devCreate named session
tmux attach -t devAttach to session
Ctrl+A, dDetach
Ctrl+A, [Scroll mode (arrows to scroll, q to exit)
Ctrl+A, cNew window
Ctrl+A, %Split vertically

Best iOS Terminal App for Remote Development

Moshi is the native iOS terminal built on mosh. It handles connection management, tmux session attachment, and push notifications automatically—purpose-built for developers using AI coding agents.

Native mosh Protocol

Moshi implements mosh natively. Combined with Tailscale's iOS app, you get true roaming:

"You can pair with Tailscale and upgrade your connection from SSH to the more stable, more responsive Mosh protocol." — Blink Shell Docs

Built-in Push Notifications

Moshi's notification system is built directly into the app. Enable notifications in Settings to get a webhook token. Notifications go to your iPhone and Apple Watch—tap to open and you're already connected.

Notifying Your AI Agent

The simplest way to enable notifications is to tell your agent how to reach you. Add this to your project's CLAUDE.md or AGENTS.md:

## Notifications

When you complete a task or need input, notify me:

curl -s -X POST https://api.getmoshi.app/api/webhook \
  -H "Content-Type: application/json" \
  -d '{"token": "YOUR_TOKEN", "title": "Done", "message": "Brief summary"}'

Replace YOUR_TOKEN with your Moshi webhook token from Settings → Notifications.

That's it. Claude Code and other agents will use this when they need you.

Voice Input Is Non-Negotiable

Typing on a phone keyboard is slow. Typing terminal commands on a phone keyboard is painful. When you're approving agent actions or giving instructions, voice input isn't a nice-to-have—it's essential.

The options:

MethodLatencyPrivacyTechnical Accuracy
Moshi (on-device Whisper)InstantFullHigh
iOS DictationLowApple serversPoor
Server-based (OpenAI, etc.)Network-dependentThird-partyHigh

iOS built-in dictation works, but it's optimized for prose—not code, paths, or technical terms. It also sends audio to Apple's servers.

Server-based transcription (like apps using OpenAI's Whisper API) can be more accurate for technical content, but adds network latency and sends your voice to third-party servers. On spotty cellular, this becomes unusable.

On-device Whisper is the sweet spot. Moshi runs Whisper locally on your iPhone—transcription happens instantly with zero network dependency. Your voice never leaves the device. Works offline, works on airplane mode, works in the subway.

When you're walking and need to tell Claude "yes, run the migration," you don't want to wait for a server round-trip or fight autocorrect.

Mobile-Optimized Keyboard

When you do need to type:

  • Dedicated Ctrl, Esc, Tab, and arrow keys
  • Tmux prefix shortcuts
  • Swipe gestures for common operations

Face ID for SSH Keys

SSH keys stored in iOS Secure Enclave, protected by Face ID. Keys never leave the device.

Why Not Blink Shell, Termius, or Prompt?

Other iOS terminal apps exist. Here's why Moshi is built different for AI agent workflows:

AppmoshPush NotificationsOn-Device VoiceAI Agent Focus
MoshiNativeBuilt-in webhooksWhisperYes
Blink ShellYesNoNoNo
TermiusNo (SSH only)NoNoNo
PromptNo (SSH only)NoNoNo

Blink Shell is excellent and supports mosh, but lacks push notifications for agent events and on-device transcription.

Termius and Prompt are SSH-only. On mobile networks, SSH connections drop constantly. Without mosh, you'll spend more time reconnecting than coding.

The key difference: Moshi is built specifically for the "AI agent on a remote server" workflow—notifications when Claude needs you, voice input for quick approvals, instant reconnection.


Complete Setup Checklist

Mac

# Tailscale
brew install tailscale
sudo tailscale up --ssh

# mosh + tmux
brew install mosh tmux

# tmux config
cat >> ~/.tmux.conf << 'EOF'
set -g history-limit 50000
set -g mouse on
set -g set-titles on
set -g set-titles-string "#S:#W"
set -g prefix C-a
unbind C-b
bind C-a send-prefix
EOF

Project

Add to CLAUDE.md or AGENTS.md:

## Notifications

When you complete a task or need input, notify me:

curl -s -X POST https://api.getmoshi.app/api/webhook \
  -H "Content-Type: application/json" \
  -d '{"token": "YOUR_TOKEN", "title": "Status", "message": "Brief summary"}'

iPhone

  1. Install Tailscale and join your tailnet
  2. Install Moshi
  3. Add your server (Tailscale IP, username)
  4. Enable notifications in Settings → copy webhook token
  5. Add token to your project's CLAUDE.md

How It Works: Approve Claude Code from Your iPhone

┌─────────────────────────────────────────────────────────────┐
│                         Your Server                          │
│  ┌────────────────────────────────────────────────────────┐ │
│  │                    tmux session                         │ │
│  │                                                         │ │
│  │  $ claude                                               │ │
│  │  > Implementing authentication...                       │ │
│  │  > Need permission to run: npm install bcrypt           │ │
│  │  > [Waiting for approval]                               │ │
│  │  > curl → Moshi webhook                                 │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
              ┌───────────────────────────┐
              │     Push Notification      │
              │    → iPhone / Watch        │
              └─────────────┬─────────────┘
                            │
              ┌─────────────▼─────────────┐
              │       Your Phone          │
              │                           │
              │  "Claude needs approval"  │
              │                           │
              │  [Tap] → Moshi opens      │
              │  tmux session waiting     │
              │  Type "y" → done          │
              └───────────────────────────┘

Start a taskWalk awayGet notifiedApprove in secondsAgent continues

No idle agents. No rushing back to your desk. Code from anywhere with your AI assistant in your pocket.


FAQ

Can I use Claude Code on my iPhone? Yes. Run Claude Code on a remote server, connect via Moshi, and interact through the terminal. You'll get push notifications when Claude needs input.

What's the best terminal app for iPhone? For AI coding workflows, Moshi. It has native mosh support, push notifications for agent events, and on-device voice transcription. For general SSH, Blink Shell is also solid.

Do I need a server to code from my phone? Yes. iPhones can't run development environments locally. You need a remote machine—a home server, VPS, or cloud instance—running your AI coding agent.

Will this work on iPad? Yes. Same setup works on iPad with Moshi.

Is Tailscale free? Yes for personal use (up to 100 devices). WireGuard is fully open source if you prefer self-hosting.


Resources