How to Run Claude Code on Your iPhone with Tailscale, tmux, and Termius
Set up Claude Code on iOS using Tailscale for networking, tmux for persistent sessions, and Termius as your SSH client.
How to Run Claude Code on Your iPhone
Want to use Claude Code — Anthropic's powerful AI coding assistant — from your iPhone? With a simple setup using Tailscale, tmux, and Termius, you can connect to your dev machine from anywhere and run Claude Code as if you were sitting at your desk.
What You Need
- A Linux or Mac machine (your dev server) with Claude Code installed
- An iPhone with the Termius app
- A Tailscale account (free tier works)
- Basic comfort with the terminal
Step 1: Install Claude Code on Your Server
If you haven't already, install Claude Code on your dev machine:
npm install -g @anthropic-ai/claude-code
Run claude once to authenticate and confirm it works.
Step 2: Set Up Tailscale
Tailscale creates a secure private network between your devices — no port forwarding, no firewall headaches.
On your server:
# Install Tailscale
curl -fsSL https://tailscale.com/install.sh | sh
# Start and authenticate
sudo tailscale up
Follow the link to log in. Your server will get a Tailscale IP (e.g., 100.x.y.z) and a hostname like my-server.
On your iPhone:
- Download Tailscale from the App Store
- Sign in with the same account
- Your iPhone is now on the same private network as your server
You can now reach your server from your phone using its Tailscale IP or hostname — no matter where you are.
Step 3: Set Up tmux on Your Server
tmux lets you run persistent terminal sessions that survive disconnections — essential for mobile use where connections can drop.
# Install tmux (if not already installed)
sudo apt install tmux # Ubuntu/Debian
brew install tmux # macOS
Create a named session for Claude:
tmux new -s claude
Now run claude inside this tmux session. If your phone disconnects, the session keeps running. Just reattach later:
tmux attach -t claude
Useful tmux shortcuts:
| Shortcut | Action |
|---|---|
Ctrl+B, D |
Detach from session (keeps it running) |
Ctrl+B, [ |
Scroll mode (swipe to scroll on mobile) |
q |
Exit scroll mode |
Step 4: Set Up Termius on Your iPhone
Termius is the best SSH client for iOS — it has a great keyboard, snippet support, and works beautifully on iPhone.
Add your server:
- Open Termius and tap + to add a new host
- Set the Hostname to your Tailscale IP or hostname (e.g.,
my-serveror100.x.y.z) - Enter your username and password (or set up an SSH key)
- Save and connect
Recommended Termius settings:
- Enable "Keep Alive" — prevents the connection from dropping when your phone locks
- Set up Snippets — save common commands like
tmux attach -t claudefor quick access - Use the extended keyboard — Termius adds Ctrl, Alt, Tab, and arrow keys above the iPhone keyboard
Putting It All Together
Here's the workflow:
- Open Termius on your iPhone
- Connect to your server via Tailscale
- Attach to tmux:
tmux attach -t claude(or create a new session if needed) - Use Claude Code — ask it to write code, debug issues, explore your codebase
- Detach when done:
Ctrl+B, D— the session stays alive on your server
If your connection drops mid-conversation, just reconnect and reattach. Claude's context is preserved in the tmux session.
Pro Tips
Use tmux windows for multitasking:
Ctrl+B, Ccreates a new window,Ctrl+B, Nswitches between them. Run Claude in one window and your tests in another.Set up Termius port forwarding if you need to preview web apps running on your server (e.g., forward
localhost:3000).Enable Tailscale SSH for passwordless connections: go to Tailscale admin console and enable SSH in Access Controls.
Battery saver: Termius can run in the background on iOS. Combined with tmux, you won't lose your session even if you switch apps.
Why This Setup Works
| Tool | Role |
|---|---|
| Tailscale | Secure networking — connect from anywhere without VPN complexity |
| tmux | Persistent sessions — survive disconnections |
| Termius | Best-in-class mobile SSH — usable keyboard and great UX |
| Claude Code | AI coding assistant running on your powerful server |
Your iPhone becomes a window into your full development environment. Claude Code runs on your server's hardware with full access to your codebase, while you interact from the couch, the bus, or a coffee shop.
Give it a try — once you experience coding with Claude from your phone, you'll wonder how you ever waited until you were at your desk.
Log in to leave a comment.