What This Solution Provides
This guide establishes a development workflow that enables you to switch between your Mac and iPhone while maintaining terminal session continuity. Using Tailscale for secure networking, Zellij for terminal multiplexing, and Terminus as an iOS SSH client, you can start work on your laptop and continue from your phone without losing context or progress.
Key advantages include network independence (functions across WiFi, cellular, and different locations), synchronized terminal sessions, persistence through network interruptions, and encrypted device-to-device communication. This setup is useful for monitoring long-running processes, making quick code changes remotely, or maintaining development workflow flexibility.
The following steps will walk you through the complete configuration process.
Prerequisites
- Mac with macOS (any recent version)
- iPhone with iOS 13+
- Basic familiarity with terminal/command line
- Admin access on your Mac
Part 1: Tailscale Setup (VPN Mesh Network)
Step 1: Create Tailscale Account
- Visit tailscale.com
- Click "Get started for free"
- Sign up using Google, GitHub, Microsoft, or email
- Choose the free personal plan (100 devices, plenty for personal use)
Step 2: Install Tailscale on Mac
- Download Tailscale for macOS from tailscale.com/download
- Open the downloaded
.pkg
file and follow the installer - Launch Tailscale from Applications or menu bar
- Click "Log in" and authenticate with your Tailscale account
- Grant necessary permissions when prompted
- Note your Mac's Tailscale IP (shown in the Tailscale menu) - typically
100.x.x.x
Step 3: Install Tailscale on iPhone
- Download "Tailscale" from the App Store
- Open the app and tap "Log in"
- Authenticate with the same Tailscale account
- Enable the VPN when prompted
- Grant VPN permissions to iOS
Step 4: Verify Connection
- On your Mac, open Tailscale and note your iPhone's IP
- In Terminal on Mac, ping your iPhone:
ping [iPhone-IP]
- You should see successful ping responses
- Both devices should now appear in your Tailscale admin console
Part 2: SSH Configuration on Mac
Step 5: Enable SSH on Mac
- Open System Preferences → Sharing (or System Settings → General → Sharing on newer macOS)
- Check "Remote Login"
- Set access to "Only these users" and add your user account
- Note the SSH connection info shown (usually your username@hostname)
Step 6: Configure SSH for Security
- Create/edit SSH config:
sudo nano /etc/ssh/sshd_config
- Add or modify these lines for better security:
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
- Restart SSH service:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load /System/Library/LaunchDaemons/ssh.plist
Part 3: Zellij Installation and Configuration
Step 7: Install Zellij on Mac
- Install using Homebrew (install Homebrew first if needed):
# Install Homebrew if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Zellij
brew install zellij
- Verify installation:
zellij --version
Step 8: Configure Zellij
- Create Zellij config directory:
mkdir -p ~/.config/zellij
- Create a basic config file:
# Zellij will create a default config on first run, but you can create one manually:
touch ~/.config/zellij/config.kdl
- Optional: Add custom configuration to
~/.config/zellij/config.kdl
:
// Example customizations
keybinds {
normal {
bind "Ctrl a" { SwitchToMode "tmux"; }
}
}
// Set default shell
default_shell "zsh"
// Theme
theme "catppuccin-mocha" // or "default", "gruvbox", etc.
Part 4: Terminus Setup and SSH Keys
Step 9: Install Terminus on iPhone
- Download "Terminus" from the App Store (by Christian Selig)
- Open the app and complete initial setup
Step 10: Generate SSH Key on iPhone
- In Terminus, tap the "⚙️" settings icon
- Go to "Keys"
- Tap "+" to create a new key
- Choose "Generate new key pair"
- Name it (e.g., "Mac Connection")
- Choose RSA 4096 or Ed25519 (recommended)
- Set a passphrase for security
- Tap "Generate"
Step 11: Copy Public Key to Mac
- In Terminus, tap your new key
- Tap "Export Public Key"
- Copy the public key text
- Send it to yourself via email/messages, or use AirDrop
- On your Mac, add the key to authorized keys:
# Create .ssh directory if it doesn't exist
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# Add the public key (replace with your actual public key)
echo "your-public-key-here" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Part 5: Connection Setup
Step 12: Configure SSH Connection in Terminus
- In Terminus, tap "+" to add a new host
- Fill in the details:
- Host: Your Mac's Tailscale IP (e.g.,
100.64.0.2
) or MagicDNS name - Port: 22
- Username: Your Mac username
- Key: Select the key you generated
- Host: Your Mac's Tailscale IP (e.g.,
- Save the connection
Step 13: Test SSH Connection
- Tap your saved connection in Terminus
- Enter your SSH key passphrase
- You should connect successfully to your Mac's terminal
Part 6: Using the Setup
Step 14: Start a Zellij Session on Mac
- Navigate to your project directory:
cd ~/your-project-folder
- Start a named Zellij session:
zellij -s work-session
- Your session is now running with the name "work-session"
Step 15: Connect from iPhone
- Open Terminus and connect to your Mac
- List available Zellij sessions:
zellij list-sessions
- Attach to your session:
zellij attach work-session
- You now have the same session mirrored on both devices in real-time!
Part 7: Workflow Tips and Optimizations
Useful Zellij Commands
# Create new named session
zellij -s project-name
# List all sessions
zellij list-sessions
# Attach to session
zellij attach session-name
# Kill session
zellij kill-session session-name
# Create new pane (while in session)
Ctrl+p + n
# Switch between panes
Ctrl+p + arrow keys
Create SSH Shortcuts (Optional)
Add to your Mac's ~/.ssh/config
:
Host mac-tailscale
HostName 100.x.x.x # Your Mac's Tailscale IP
User yourusername
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 60
iOS Shortcuts (Optional)
- Create an iOS Shortcut that opens Terminus and runs:
zellij attach work || zellij -s work
Troubleshooting
Connection Issues
- Can't ping between devices: Check Tailscale is running on both devices
- SSH connection refused: Verify Remote Login is enabled in Mac System Preferences
- Key authentication failed: Double-check the public key was added correctly to
~/.ssh/authorized_keys
Zellij Issues
- Session not found: Use
zellij list-sessions
to see available sessions - Permission denied: Check file permissions on SSH keys and config files
- Commands not working: Default Zellij prefix is
Ctrl+p
, notCtrl+b
(tmux)
Network Issues
- Slow connection: Try direct IP instead of MagicDNS
- Frequent disconnects: Add
ServerAliveInterval 60
to SSH config - Can't connect on cellular: Restart Tailscale app on iPhone
Security Notes
- Always use SSH keys, never passwords for remote access
- Keep your SSH keys secure and use passphrases
- Regularly update Tailscale and Terminus
- Consider using hardware security keys for Tailscale login
- Monitor your Tailscale admin console for unauthorized devices
Next Steps
Once you have this working:
- Set up dotfiles syncing for consistent shell environment
- Configure Zellij layouts for different project types
- Add development tools that work well in terminal (htop, git, your preferred editors)
- Consider setting up port forwarding for accessing local web servers from your phone's browser