# How to Run Claude Code on iPhone (SSH, tmux, and Setup)

> Source: <https://onepilotapp.com/blog/claude-code-iphone>
> Published: 2026-06-27 00:00:00+00:00

Claude Code is Anthropic's agentic coding tool: it reads your codebase, runs commands, edits files, and commits code. It's built for the terminal, and it runs on a server, not on the phone. That's exactly why your iPhone can drive it: anything that holds an SSH session can reach the agent.

## What do you need to run Claude Code on iPhone?

Three things:

- An iPhone with an SSH terminal app
- A server with SSH access (a cloud VPS, or a home machine on Tailscale)
- A Claude Code subscription (Anthropic Max plan) or API key

## Step 1: Make Sure You Can Reach the Server

Before anything else, your phone has to be able to open an SSH connection to the box. If it's a cloud VPS with a **public IP**, you're set; connect straight to it from anywhere. If Claude Code lives on a machine **behind NAT**, say a Mac mini, a Raspberry Pi, or your laptop at home, it has no public address, so put it on a private network like [Tailscale](https://tailscale.com/) and reach it over its tailnet address. This step is unavoidable for NAT'd hosts regardless of which app you use; it's how the network works.

## Step 2: Install Claude Code on the Server

If it isn't installed yet, SSH in and install it:

`npm install -g @anthropic-ai/claude-code`

Authenticate with your Anthropic account or set your API key as an environment variable.

## Step 3: Connect from Your iPhone

Add your server (hostname or tailnet address, username, SSH key) and connect. You get a full, real terminal; Claude Code's interactive UI renders natively.

## Step 4: Start Claude Code Inside tmux

Don't launch the agent in a bare session; if your phone locks or switches networks, the connection can drop and take the agent with it. Start it inside **tmux** so it survives:

`tmux new -s claude`

Then, in your project directory, run:

`claude`

Claude Code launches in interactive mode, the same interface as on a desktop terminal, file diffs and tool calls and all, rendered on your phone. If you disconnect, reattach later with `tmux attach -t claude`

and it's exactly where you left it.

## Step 5: Give It a Task

Type your task in natural language:

*"Fix the failing CI tests in the payments module"**"Add rate limiting to the API endpoints"**"Refactor the database queries to use connection pooling"*

Claude Code reads the relevant files, proposes changes, and executes them after your approval.

## Tips for running Claude Code on iPhone

**Use headless mode** for long tasks:`claude -p "your task here"`

runs without interactive prompts**Name a tmux session per task**:`tmux new -s fix-auth`

,`tmux new -s migrate-db`

, so several agents stay untangled**Start big tasks before idle time**(commute, lunch, overnight) and let the agent work while you're away

## Why Not Just Use a Laptop?

You absolutely can. But laptops aren't always available. Claude Code on mobile isn't about replacing your desk setup; it's about never being blocked. Incident at 2 AM, idea on the train, quick fix between meetings. Your phone is always there.

For the deeper version of the reachability and session-persistence problem, and where the manual tmux-and-Mosh dance starts to chafe on a phone, see [running AI coding agents from your iPhone over SSH](/blog/run-ai-agents-iphone-ssh). Still picking an SSH client? The [Termius vs Blink comparison](/blog/termius-vs-blink-vs-onepilot) covers the options, or start from scratch with the [SSH from iPhone guide](/blog/ssh-iphone-guide). If you'd rather skip the tmux ceremony and get native push when the agent needs you, that's what [Onepilot](/) is built for.
