"Vibe coding" was named Collins Dictionary's Word of the Year for 2025, and for good reason. The practice of guiding AI assistants to generate, refine, and debug code through natural language has fundamentally changed how we build software. But here's what most vibe coding guides miss: you don't need to be chained to your desk to do it.
I recently set up a workflow that lets me access Claude Code running on my MacBook Pro from my iPhone, from anywhere with an internet connection. Whether I'm waiting for a flight, sitting in a coffee shop, or just away from my desk when inspiration strikes, I can pick up exactly where I left off with a full AI-powered development environment.
This guide walks through exactly how to set it up, step by step, even if you've never touched a terminal multiplexer or configured SSH before.
Why This Setup Matters
Claude Code is an agentic coding tool that runs in your terminal, understands your codebase, and helps you code faster through natural language. Unlike browser-based AI assistants, it has direct access to your file system, can execute commands, and maintains context across your entire project.
The problem? It runs locally on your machine. When you walk away from your laptop, your Claude Code session ends.
The solution combines three tools:
- Tailscale - A mesh VPN that securely connects your devices without complex network configuration
- Termius - An SSH client for iPhone that provides a real terminal experience
- tmux - A terminal multiplexer that keeps your sessions running even when you disconnect
The magic of this combination: you can start a Claude Code session on your MacBook, close your laptop, walk away, then reconnect from your iPhone hours later and pick up exactly where you left off. The session persists on your Mac, and tmux maintains the state.
What You'll Need
Before we start, make sure you have:
The entire setup takes about 20-30 minutes.
Step 1: Install Claude Code on Your Mac
First, let's get Claude Code installed. Open Terminal on your Mac and run:
npm install -g @anthropic-ai/claude-code
After installation, navigate to any project directory and run claude to complete the initial OAuth setup with your Anthropic account.
cd ~/your-project
claude
The first launch will guide you through connecting your account. Once that's done, you have a working Claude Code installation.
★ Insight ─────────────────────────────────────
Claude Code runs locally without a backend server; it talks directly to Anthropic's API. This means your code stays on your machine, addressing many of the security concerns around AI-generated code that come from pasting sensitive code into web interfaces.
─────────────────────────────────────────────────
Step 2: Install tmux
tmux is what makes your sessions persistent. Without it, closing your SSH connection would kill whatever was running in that terminal, including Claude Code.
Install tmux using Homebrew:
brew install tmux
If you don't have Homebrew, install it first from brew.sh.
Why tmux matters: According to Linode's documentation, "If the client is disconnected, the server keeps running. When you reconnect... you can reattach to the tmux session and the files you were working with will still be open, and the processes you had running will still be active."
This is the key that makes remote vibe coding possible.
Step 3: Enable Remote Login (SSH) on Your Mac
Your Mac needs to accept incoming SSH connections. Here's how to enable it:
- Open System Settings
- Navigate to General → Sharing
- Turn on Remote Login
- Set "Allow access for" to include your user account (or Administrators)
- Optionally enable "Allow full disk access for remote users"
To verify SSH is working, test it locally:
ssh yourusername@localhost
If you can connect to yourself, SSH is configured correctly.
Step 4: Set Up Tailscale on Both Devices
This is where the magic happens. Tailscale is a mesh VPN that creates a secure network between your devices, with no complex firewall rules or port forwarding required.
On Your Mac
- Download Tailscale from the App Store or tailscale.com
- Open Tailscale and sign in with your preferred identity provider (Google, GitHub, etc.)
- Click the menu bar icon to confirm it shows "Connected"
- Note your Tailscale IP (something like
100.x.x.x) and hostname
To find your Tailscale hostname:
tailscale status
Your hostname will look something like your-macbook.tailnet-name.ts.net.
On Your iPhone
- Download Tailscale from the App Store
- Open Tailscale and sign in with the same account you used on your Mac
- Toggle the connection on
- Confirm both devices appear in the device list with green status indicators
That's it. Your iPhone and Mac can now communicate securely over any network: home WiFi, cellular data, hotel WiFi, anywhere.
★ Insight ─────────────────────────────────────
Unlike traditional VPNs that route all traffic through a central server, Tailscale creates direct peer-to-peer connections between your devices using the WireGuard protocol. This means lower latency and no bandwidth bottleneck, which is critical for a responsive terminal experience.
─────────────────────────────────────────────────
Step 5: Configure Termius on Your iPhone
Termius is a professional SSH client for iOS with a real keyboard experience and support for SSH keys.
- Download Termius from the App Store
- Go to Hosts and tap + to add a new host
- Configure the connection:
- Alias: MacBook Pro (or whatever you want to call it)
- Address:
your-macbook.tailnet-name.ts.net (use the Tailscale hostname, not the IP)
- Port: 22
- Username: Your Mac username
- Password: Your Mac password (for now; we'll set up keys next)
- Save and tap to connect
If everything is configured correctly, you should see your Mac's terminal prompt.
Set Up SSH Keys for Passwordless Login
Typing your password on a phone keyboard gets old fast. Let's set up SSH keys:
Generate a key in Termius:
- Tap the Keychain icon (key symbol)
- Tap + → Generate Key
- Select ED25519 (more secure and shorter than RSA)
- Name it "iPhone"
- Tap Save
Export the key to your Mac:
- In Keychain, tap your "iPhone" key
- Tap Export to Host
- Enter your Mac's Tailscale hostname, port 22, and username
- Tap Export and enter your Mac password when prompted
Link the key to your host:
- Go back to Hosts
- Edit your MacBook host
- Set Key to "iPhone"
- Save
Now connections are instant and passwordless.
Step 6: Using tmux with Claude Code
Here's the workflow that ties everything together.
Starting a New Session
SSH into your Mac from Termius, then:
tmux new -s claude
claude
This creates a new tmux session named "claude" and starts Claude Code inside it. You can now work with Claude Code from your iPhone.
Disconnecting Safely
When you're done, you can simply:
- Close Termius
- Let your phone lock
- Switch to another app
The tmux session keeps running on your Mac. Claude Code stays active.
Reconnecting Later
Next time you connect from your iPhone (or your Mac, or anywhere):
tmux attach -t claude
You'll pick up exactly where you left off: same Claude Code session, same context, same conversation.
Managing Multiple Sessions
Working on multiple projects? Create separate sessions:
tmux new -s backend
tmux new -s frontend
tmux new -s experiments
tmux ls
tmux attach -t frontend
Essential tmux Commands
| Action | Command |
|---|
| Detach from session | Ctrl+B then D |
| List sessions | tmux ls |
| Kill a session | tmux kill-session -t name |
| Rename session | Ctrl+B then $ |
| Create new window | Ctrl+B then C |
| Switch windows | Ctrl+B then window number |
★ Insight ─────────────────────────────────────
The Ctrl+B is tmux's "prefix key." You press it first, then the command key. Think of it as telling tmux "the next key is for you, not for the program running inside." This lets tmux capture keyboard shortcuts without interfering with Claude Code or other terminal applications.
─────────────────────────────────────────────────
Testing Dev Servers from Your iPhone
Here's a bonus: you can also preview local development servers on your iPhone.
When running a dev server, bind it to all network interfaces:
npm run dev -- --host
npx next dev -H 0.0.0.0
npm start -- --host
python manage.py runserver 0.0.0.0:8000
Then open Safari on your iPhone and navigate to:
http://your-macbook.tailnet-name.ts.net:3000
(Replace 3000 with whatever port your dev server uses.)
Your iPhone can now preview your local development work in real-time, testing touch interactions and mobile layouts on actual hardware.
Troubleshooting
Connection Times Out
Check Tailscale on both devices:
- iPhone: Open Tailscale app, confirm toggle is on and shows "Connected"
- Mac: Click menu bar icon, confirm it shows "Connected"
- Both devices should appear in each other's device lists
Use hostname instead of IP:
Use your-macbook.tailnet-name.ts.net instead of the raw IP address. Termius may attempt IPv6 resolution with raw IPs, causing connection issues.
Verify SSH is listening:
sudo lsof -i :22
Should show launchd listening on *:ssh.
Tailscale Devices Don't See Each Other
- Toggle Tailscale off and on on both devices
- Check the Tailscale Admin Console. Both should show as "Connected"
- Confirm both devices are signed into the same Tailscale account
- Try pinging from your Mac:
ping 100.x.x.x (your iPhone's Tailscale IP)
SSH Key Not Working
Verify the key is on your Mac:
cat ~/.ssh/authorized_keys
Your iPhone's public key should be there.
Check permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Manually add the key if export failed:
- In Termius Keychain, tap your key and copy the public key
- SSH in with your password
- Run:
echo "paste-public-key-here" >> ~/.ssh/authorized_keys
tmux Session Not Found
tmux ls
tmux new -s claude
Note: tmux sessions don't survive Mac reboots. If your Mac restarted, you'll need to create a new session.
Claude Code Not Found
which claude
npm install -g @anthropic-ai/claude-code
macOS Firewall Blocking Connections
- Go to System Settings → Network → Firewall
- Either turn off the firewall or add an exception for Remote Login/SSH
Quick Reference
| Task | Command |
|---|
| Connect from iPhone | Open Termius → tap MacBook host |
| Start coding session | tmux new -s claude then claude |
| Reconnect to session | tmux attach -t claude |
| List tmux sessions | tmux ls |
| Detach from session | Ctrl+B then D |
| Check Tailscale IP | tailscale ip -4 |
| Test SSH locally | ssh yourusername@localhost |
The Bigger Picture
Y Combinator reported that 25% of startups in their Winter 2025 batch had codebases that were 95% AI-generated. The definition of "developer" is expanding to include people who guide AI rather than write every line by hand.
This setup (Claude Code, tmux, Tailscale, and a mobile SSH client) removes one of the last friction points: being tied to a physical location. The session persistence means you can think about a problem on a walk, pull out your phone, and immediately start working with an AI assistant that has full context on your codebase.
As research from Full Scale notes, AI assistants can automate up to 65% of repetitive tasks. Having that capability available anywhere, not just at your desk, compounds the productivity gains.
The hard part isn't the technology; it's building the habit of treating your phone as a legitimate development tool rather than just a consumption device. Start with small tasks: code reviews, debugging a specific issue, or planning the next feature with Claude. The sessions persist, so you can pick up wherever you left off.
That's the real power of this setup: development work that fits into the gaps of your day, powered by an AI that never loses context.