How to Run Claude Code, Codex, or Gemini CLI from an iPhone

Coding agents changed what a phone is good for. The work is no longer typing. It is starting a task, watching it run, reading the diff, and saying yes or no. That fits a phone far better than writing code ever did. The awkward part is everything around it: an SSH session that dies the moment you switch networks, no way to see the dev server the agent just started, and a terminal that makes reviewing a diff miserable. Here is how to set that up properly with Claude Code, Codex, or Gemini CLI running on a server you own.

Written by the GateShell team at Hefty Innovations

Step by step

  1. 1

    Install the agent CLI on the server, not the phone

    The agent runs on your server, under your account, with your own provider credentials. Install whichever CLI you use (Claude Code, Codex, or Gemini CLI) the normal way, and confirm it runs when you SSH in from a laptop. Nothing about this step is GateShell-specific, and nothing routes through us: your provider traffic goes from your server to your provider, exactly as it does today.

  2. 2

    Add the server to GateShell and connect

    Add the host, port, username, and either a password or an SSH key. Keys can be generated on-device, including hardware-backed Secure Enclave keys that cannot be exported. If the server sits behind a bastion, set a jump host on the server record and GateShell will chain the hops with per-hop authentication and host-key checks.

  3. 3

    Turn on Mosh so the session survives your commute

    This is the step that makes agent work practical on a phone. A plain SSH session dies when you switch from Wi-Fi to cellular, lock the screen, or walk into a lift, and an agent mid-task dies with it. With Mosh enabled, GateShell bootstraps over verified SSH and then moves to an encrypted UDP transport that roams across network changes. Enable it per server; if UDP is blocked, GateShell falls back to SSH and tells you rather than failing silently. Pairing it with tmux auto-attach means the work continues server-side even in the worst case.

  4. 4

    Start or resume the agent from the coding workspace

    Open the coding workspace and GateShell detects which agent CLIs are actually installed on that server. Pick a project directory, then start a new session or resume an existing one. The agent runs in the live terminal, so you can read its output as it works and interrupt it at any point, the same control you would have sitting at the machine.

  5. 5

    Review the diff before you accept anything

    Reading a unified diff in a raw terminal on a phone is where this workflow usually falls apart. Open the git view instead: staged and unstaged changes are parsed into per-file, per-hunk diffs with real line numbers, so you can judge what the agent actually changed before committing. This is the step worth slowing down for: the agent is fast, and the review is the part that protects you.

  6. 6

    Look at what it built, without leaving the app

    When the agent starts a dev server, open App Preview. GateShell lists the ports actually listening on the machine, opens an ephemeral loopback tunnel over the SSH connection you already have, and renders the app in an embedded browser. No public exposure, no ngrok, no redeploy: the traffic goes through your existing authenticated session. It is HTTP only for now, and the app needs to accept connections on IPv4 loopback.

Frequently asked questions

Does GateShell see my Claude Code or OpenAI API keys?+

No. The agent runs on your server under your account, using the CLI and credentials already configured there. GateShell opens an SSH session and shows you the terminal. It never proxies your provider traffic and never handles your provider keys. There is no GateShell account and no backend in that path.

Why not just SSH in with any terminal app and run the agent?+

You can, and for a five-minute task it is fine. The difference shows up over longer sessions: a plain SSH connection drops when the network changes or the app backgrounds, which kills the agent mid-task. Mosh roaming and tmux auto-attach keep the session alive, the git diff view makes review possible on a small screen, and App Preview lets you see what was built without deploying it anywhere.

Which coding agents are supported?+

Claude Code, Codex, and Gemini CLI are detected automatically if they are installed on the server. Because the workspace launches the CLI in a normal interactive shell rather than wrapping a specific API, other command-line agents generally work too; you just start them yourself instead of picking them from the list.

Can I do this on iPad or Mac as well?+

Yes. GateShell is a universal app for iPhone, iPad, and Mac, and your servers, snippets, and known hosts sync through your own private iCloud database. Start a task on your phone, pick up the review on an iPad with a keyboard.

What happens if the agent runs something destructive?+

GateShell classifies command risk on-device before it runs and warns you on anything dangerous, with a hard floor for catastrophic operations. The multi-step agent mode also proposes its plan and waits for you to approve each step. None of that analysis leaves your device; it runs locally through Apple Intelligence.

Try it in GateShell

GateShell is a zero-backend SSH client for iPhone, iPad, and Mac, with no vendor cloud, no accounts and no telemetry. Everything above works out of the box.

Guide reflects GateShell's shipped features as of September 2026. Steps assume basic familiarity with SSH and the command line; server-side commands may vary by distribution. All product names, logos, and brands are property of their respective owners.