Back/claude code

Using Claude Code on Phone

Updated 2026-04-11
3 min read
571 words

Using Claude Code on Phone

Mobile access to Claude Code enables development from anywhere. The key is tmux - session persistence across different terminals.

The Core Insight

"还得是 tmux,走到哪都能用。" - @lewangx

With tmux, your session persists across different terminals. Switch devices, reconnect, and your work environment remains exactly as you left it.

Setup Overview

Components

  1. Terminus - SSH client app for mobile
  2. Mac with SSHD - Development machine running SSH server
  3. frp or Tailscale - Port forwarding or mesh VPN for external access
  4. tmux - Terminal multiplexer for session persistence

Step-by-Step Setup

1. Install Terminus on Phone

Download Terminus (or similar SSH client) from your app store.

2. Enable SSH on Mac

# Enable remote login (SSH)
sudo systemsetup -setremotelogin on

# Or via System Settings > General > Sharing > Remote Login

3. Port Forwarding Options

Option A: frp (Fast Reverse Proxy)

# Use frp to map Mac's port 22 to external access
# Configure frpc.ini with your server details

Option B: Tailscale (Recommended)

# Install Tailscale on both Mac and phone
# Creates mesh VPN - no port forwarding needed
# More secure, easier setup

4. Configure tmux

# Install tmux if not present
brew install tmux

# Start a named session
tmux new -s claude

# Or attach to existing
tmux attach -t claude

5. Connect from Phone

  1. Open Terminus
  2. Add SSH connection:
    • Host: Your forwarded IP or Tailscale IP
    • Port: 22 (or forwarded port)
    • Username: Your Mac username
    • Authentication: Password or SSH key
  3. Connect and attach to tmux session

Workflow

Daily Usage Pattern

  1. On Mac: Start tmux session with Claude Code

    tmux new -s dev
    claude
    
  2. On Phone: SSH in and attach

    tmux attach -t dev
    
  3. Session persists - Switch between Mac terminal and phone seamlessly

mosh Alternative

For unstable connections, consider mosh (mobile shell):

# Install mosh
brew install mosh

# Use instead of SSH for roaming and intermittent connectivity
mosh user@host -- tmux attach

Community Configurations

@fxzer8888's Setup

Shared detailed configuration screenshots via Gemini-powered setup, implemented by Claude Code in one shot.

@LanternCX's Stack

Terminus app with SSH + Tailscale for port 22 access.

@laoshaoping_an's Stack

mosh + tmux + Tailscale combination for maximum reliability.

@G36_maid's Stack

Terminus + tmux + Tailscale - the minimal effective setup.

Security Considerations

  • Use SSH keys instead of passwords when possible
  • Tailscale over frp - Avoid exposing ports to internet
  • Monitor active sessions - Check who's connected
  • Lock Mac when away - Physical security still matters

Limitations

  • Screen size - Phone screens require more scrolling
  • Input methods - Touch keyboard vs physical keyboard
  • Connection stability - Mobile networks may drop
  • Battery drain - Active SSH sessions consume power

Best Practices

  1. Use persistent sessions - tmux is essential
  2. Keep sessions lean - Don't run heavy builds on phone
  3. Prefer Tailscale - More secure than port forwarding
  4. Test locally first - Ensure Mac setup works before going mobile
  5. Have fallback - Keep laptop accessible for complex tasks

Contributors: @lewangx, @fxzer8888, @LanternCX, @laoshaoping_an, @G36_maid

Sources

Linked from