Blog/tmux on iOS

tmux on iOS: keep Claude Code running through disconnects

2026-07-17

iOS suspends apps that leave the foreground, and mobile connections drop. If your Claude Code session lives inside the SSH connection itself, either one kills it — a 40-minute refactor dies at minute 38 because the train went into a tunnel.

The standard fix is tmux: a terminal multiplexer that keeps your shell and everything in it running on the server, whether or not anyone is connected. The SSH connection can drop and come back; the session does not care.

The manual workflow

With any generic SSH client, the drill looks like this:

ssh dev@your-server
tmux new -A -s claude    # create or attach
cd ~/projects/app
claude                   # start the agent
# ... connection drops on the train ...
ssh dev@your-server
tmux attach -t claude    # everything still running

This works fine. The problem on a phone is the amount of typing: after every drop you reconnect and re-attach by hand, you have to remember the session name for each project, parallel runs mean several named sessions to keep track of, and there is no notification when a run finishes, so you end up re-attaching just to check.

What ServerCC automates

ServerCC treats tmux as infrastructure, not as something you type. When you open a workspace and start Claude Code (or Codex):

  • The agent is launched inside a tmux session automatically — no session naming, no new -A to remember
  • Reconnects re-attach to the right session for that workspace, every time
  • Parallel instances get their own sessions, visible side by side in Agent View
  • Long runs can go to bg mode and notify you on completion — no more attach-to-check loops

You can close the app and the work keeps going. Details in Persistent Sessions.

Tips if you roll your own

  • tmux new -A -s name is idempotent — safe to use as your single connect command
  • Keep PATH setup in .bashrc/.zshrc (not only .bash_profile) — tmux inner shells are interactive non-login, so profile-only PATH means "claude not found"
  • Set set -g mouse on for scrollback that behaves on touch screens

Curious how the full mobile workflow looks? Start with Claude Code on iPhone.