Turn Your Phone into a Remote Coding IDE with tmux, Tailscale, Termius & Claude Code
This guide shows how to combine tmux, Tailscale, Termius, and Claude Code to create a portable development environment that lets you code, debug, and deploy from any device during the Spring Festival holidays.
Tool Overview
tmux – Terminal Multiplexer
Provides virtual desktops inside a terminal. Sessions persist after disconnection, allowing long‑running processes, split screens, and named sessions for different projects.
Sessions stay alive after you leave.
Long‑running processes survive network interruptions.
Multiple panes act like multiple monitors.
Named sessions such as "work‑project" or "rust‑learning".
Common shortcuts: Ctrl+b d – detach session (keeps running in background). Ctrl+b c – create new window. Ctrl+b % – vertical split. Ctrl+b " – horizontal split.
Tailscale – Simple Mesh VPN
Assigns each device a private IP (e.g., 100.64.1.5) and creates a secure mesh network using WireGuard. No port‑forwarding or firewall configuration is required.
Private IP per device.
Direct device‑to‑device connection.
No complex port forwarding.
End‑to‑end encryption.
Works through any firewall or NAT.
Termius – Mobile SSH Client
Provides a touch‑screen terminal experience with proper SSH‑key handling, cross‑device sync, built‑in SFTP, and keyboard shortcuts.
Claude Code – Command‑line AI Coding Assistant (Anthropic)
Runs in the terminal and can generate functions, debug errors, refactor code, add tests, explain codebases, and assist with Git operations.
Better context understanding than GitHub Copilot.
Handles multi‑file operations.
Accurately grasps user intent.
Works directly in the terminal.
Step‑by‑Step Setup
Step 1: Install Tailscale
Download from https://tailscale.com/, install, register (Google or GitHub login speeds up the process), note the Tailscale IP (e.g., 100.x.x.x), and the device is connected to the private network.
Step 2: Install tmux (Mac example)
# Install tmux
brew install tmux
# Create basic config
cat > ~/.tmux.conf << 'EOF'
# Faster response
set -s escape-time 1
# Mouse support (important for mobile)
set -g mouse on
# Better colors
set -g default-terminal "screen-256color"
# More history
set -g history-limit 10000
# Windows/panes start at 1
set -g base-index 1
setw -g pane-base-index 1
# Status bar tweaks
set -g status-left-length 40
set -g status-left "#[fg=green]#S #[fg=yellow]#I:#P"
EOFTest configuration:
tmux new-session -d -s test
tmux list-sessions
tmux attach-session -t testDetach with Ctrl+b d to keep the session running.
Step 3: Enable SSH on Mac
Open System Preferences → Sharing.
Check “Remote Login”.
Set access to “Only these users” and add your account.
Test:
ssh yourusername@localhostStep 4: Install Claude Code
# Install Claude Code (requires node & npm)
npm install -g @anthropic-ai/claude-codeVerify:
claude --helpStep 5: One‑click tmux function
# Add to ~/.bashrc, ~/.zshrc, or ~/.bash_profile
function claude-tmux() {
if tmux has-session -t claude 2>/dev/null; then
tmux attach -t claude
else
tmux new -s claude
fi
}Reload shell: source ~/.zshrc # or source ~/.bashrc Now claude-tmux instantly opens an existing session or creates a new one.
Step 6: Use Termius & Tailscale on Phone
Install Termius and Tailscale from the app store.
Create a host entry with your Tailscale IP, Mac username, port 22, and a label.
Connect via Termius to obtain full terminal access on the phone.
Real‑World Scenarios
Scenario 1: Fix a Deployment Failure
# Connect via Termius (≈5 s)
ssh yourmac
# Jump straight into tmux session
claude-tmux
# Use Claude to debug
claude "explain this error: [paste error log]"
claude "fix this deployment issue in docker-compose.yml"Scenario 2: Learn on the Go
# SSH to Mac and start session
ssh yourmac
claude-tmux
# Ask Claude for Rust lessons
claude "teach me about rust ownership with examples"
claude "create a simple rust program that demonstrates borrowing"Scenario 3: Side‑Project Development
# SSH to Mac
ssh yourmac
# Use side‑project tmux function
side-project-tmux
# Get AI help
claude "write a REST API in FastAPI for a todo app"
claude "add proper error handling to this function"
claude "generate OpenAPI docs for these endpoints"Scenario 4: Quick Code Review During Vacation
# SSH and enter tmux
ssh yourmac
claude-tmux
# Clone PR branch
git fetch origin pull/12345/head:pr-branch
git checkout pr-branch
# Review with Claude
claude "review this code for potential bugs: [paste code]"
# Commit and push
git add .
git commit -m "Review comments"
git pushAdvantages of the Combined Setup
Single command ( claude-tmux) creates or attaches to a tmux session.
Mobile workflow: Termius → claude-tmux → start coding.
No need to remember session names.
Works for both resuming existing work and starting new tasks.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Tech Publishing
In the fast-evolving AI era, we thoroughly explain stable technical foundations.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
