OnepilotDownload
Onepilot mascot

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

Run Claude Code from your iPhone or iPad: SSH into your server, keep the agent alive with tmux, reach a box behind NAT, and give it tasks, step by step.

sofiane8910

by sofiane8910 · March 18, 2026 · 6 min read · updated July 25, 2026

TL;DR

Claude Code runs on a server, so your iPhone drives it over SSH. Make sure you can reach the box (its public IP for a VPS, or a tunnel or relay for a machine behind NAT), install Claude Code, connect from an iOS terminal, and start it inside tmux so a locked phone doesn't kill the session. Five steps, then give it a task in plain English.

Onepilot runs these agents from your iPhone, download it on the App Store.

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:

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 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:

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

Tips for running Claude Code on iPhone

Can you run Claude Code on an iPad?

Yes, and the steps above are unchanged. Claude Code runs on the server either way, so the iPad is doing exactly what the iPhone does: holding an SSH session to the machine where the agent actually lives. Every command in this guide works as written.

What the iPad adds is room. Agent output is dense, with file diffs, tool calls, and multi-line plans, and the extra screen makes a long run genuinely readable rather than a scroll. Split View lets you keep documentation or the repo on GitHub next to the session. Most usefully, a hardware keyboard turns tmux attach -t claude and interrupt sequences like Ctrl-C back into muscle memory instead of a hunt through a touch key bar.

The limits are the same ones, though. iPadOS suspends backgrounded apps, so switching away long enough still drops the connection, which is why starting the agent inside tmux matters just as much here. And an iPad behind the same NAT as everything else still needs a way in, covered in SSH without port forwarding.

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. Still picking an SSH client? The Termius vs Blink comparison covers the options, or start from scratch with the SSH from 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.

FAQ

Can I run Claude Code on my iPhone?

Yes, though Claude Code runs on a remote server, not on the phone itself. You SSH into the server from an iOS terminal app, start Claude Code inside a persistent session (tmux or screen), and interact with it in the terminal. If the server is a cloud VPS you connect to its public IP directly; if it sits behind NAT (a home Mac or Pi) you reach it over a private network like Tailscale.

Do I need a Claude Code subscription to use it on mobile?

Yes. Claude Code requires an active Anthropic subscription (Max plan) or an API key. That is separate from whatever SSH app you use to connect; the app handles the terminal connection, the subscription handles the agent.

How do I stop Claude Code from dying when my phone locks?

Start it inside tmux: run `tmux new -s claude`, launch `claude` inside that session, and it keeps running on the server even if your SSH connection drops when the phone sleeps. Reconnect later with `tmux attach -t claude` to pick up exactly where it was. Mosh further smooths reconnects across Wi-Fi/cellular changes.

Do I need Tailscale to run Claude Code from my phone?

Only if the server is behind NAT. A cloud VPS with a public IP needs no tunnel; you connect straight to it. A home Mac mini, Raspberry Pi, or laptop has no public address, so you either put it on a private network like Tailscale and SSH in over its tailnet address, or use a client that provisions an outbound relay for you so the host dials out instead.

Related reading

Run your AI agents from your iPhone

Download Onepilot on the App Store.

See also: the three-layer agent overview, run Hermes on iPhone, or all articles.