Use your dev machine from Anywhere

Ever wanted to check on a long-running task while grabbing coffee? Or maybe you’re lying in bed wondering if that build finally finished? I’ve been there. After setting up this workflow, I can monitor and control any terminal session from my phone or iPad, whether it’s Claude Code, Gemini CLI, Codex, OpenCode, or just a regular script.

What We’re Using

  • Tailscale: Secure networking to reach your Mac from anywhere
  • SSH Keys + Mosh: Resilient terminal connections that handle network changes
  • tmux: Session persistence so your task keeps running even if you disconnect
  • Blink Shell: Terminal app for iOS and iPadOS

The workflow: Start your task in a tmux session on your Mac, connect via Mosh from your phone, and monitor/control everything remotely.

Prerequisites

  • A Mac (or any machine you want to access remotely)
  • iPhone/iPad with decent data/WiFi

Step 1: Install Tailscale

Tailscale creates a secure private network between your devices. Think of it as a VPN that “just works.”

On your Mac

  • Download Tailscale and install
  • Sign up and connect to your tailnet
  • Note your machine name (usually something like macbook-yourname)

On your phone

  • Install the Tailscale app
  • Connect to the same tailnet
  • Verify you can see your Mac in the device list

Step 2: Set Up SSH Keys

We’ll use SSH keys instead of passwords for secure, seamless authentication.

Generate SSH key on your phone

I’m using Blink Shell (iOS Only) as it seems best option for Apple ecosystem:

  • Install Blink Shell
  • Go to Settings → Keys
  • Generate a new key using the Secure Enclave feature
  • Copy the public key

Add the key to your Mac

# Create SSH directory if it doesn't exist
mkdir -p ~/.ssh

# Add your phone's public key
nano ~/.ssh/authorized_keys
# Paste the public key from your phone, save and exit

# Set correct permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Step 3: Configure SSH Server

Edit your Mac’s SSH configuration to use key authentication:

sudo nano /etc/ssh/sshd_config

Add or modify these lines:

PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no

Enable SSH and restart the service:

# Enable Remote Login in System Preferences → Sharing
# Or via command line:
sudo systemsetup -setremotelogin on

# Restart SSH service
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd

Step 4: Install and Configure Mosh

Mosh is like SSH but handles network changes gracefully – perfect for mobile use.

On your Mac

# Install via Homebrew
brew install mosh

# Verify installation
which mosh-server

Test the connection

From Blink Shell, try connecting:

# Replace with your Mac's username and Tailscale IP
ssh yourusername@100.xxx.xxx.xxx

If SSH works without asking for a password, you’re ready for Mosh:

mosh yourusername@100.xxx.xxx.xxx

Step 5: Set Up tmux

tmux keeps your sessions running even when you disconnect. For a complete tmux guide, check out our tmux blog post.

Step 6: The Complete Workflow

Starting a session

# Connect via Mosh from your phone
mosh yourusername@100.xxx.xxx.xxx

# Start or attach to tmux session
tmux new-session -A -s dev

# Start your task (e.g., claude, gemini, codex, opencode, or any script)
your-command-here

# When you need to go AFK, detach from tmux
# Press: Ctrl+B(Prefix), then D

Accessing Your Session from Anywhere

Now your session is running persistently on your Mac inside tmux. You can disconnect and reconnect from any of your devices without interrupting the process.

From your iPhone/iPad: Open Blink Shell and connect. Mosh will often automatically resume your last session. If not, just re-attach:

# Connect via Mosh
mosh yourusername@100.xxx.xxx.xxx

# Re-attach to the tmux session
tmux attach -t dev

From your Mac: Open your local terminal. You don’t need to mosh since you’re already on the machine. Just attach to the session directly:

# Attach to the running session
tmux attach -t dev

You are now looking at the exact same terminal screen from two different devices. Any command you type on one will appear on the other. This is the power of tmux combined with mosh and tailscale. Your task keeps running, no matter where you are.

Troubleshooting

Mosh connection fails?

  • Check if mosh-server is in your PATH: which mosh-server
  • Try specifying full path: mosh --server="/opt/homebrew/bin/mosh-server" user@ip

SSH asks for password?

  • Verify your public key is in ~/.ssh/authorized_keys
  • Check file permissions: ls -la ~/.ssh/

Can’t reach your Mac?

  • Confirm both devices are connected to Tailscale
  • Find your Mac’s Tailscale IP: tailscale ip -4 on your Mac
  • Try the Mac’s Tailscale IP directly

Setting up remote access takes some initial configuration, but the freedom it provides is worth it.

The combination of Tailscale, Mosh, and tmux creates a robust foundation for remote work, whether you’re running AI assistants, builds, scripts, or anything else that lives in the terminal.

Blink-shell UI