Turn a Mac at home into a private personal server you can access from an iPhone with Tailscale, SSH, and tmux—without router port forwarding.
Photo by Annie Spratt on Unsplash.
Your Mac at home can be a surprisingly useful personal server. With Tailscale, SSH, and tmux, you can open a terminal from an iPhone, start a build or coding agent, close the mobile app, and reconnect later without losing the process.
No router port forwarding. No public VPS. No SSH service exposed directly to the internet.
This guide uses the simplest reliable setup:
The Mac must be powered on and connected to the internet. tmux survives an SSH disconnect, but it cannot keep a sleeping Mac reachable. For long-running jobs, we will use macOS's built-in caffeinate command.
For most people, install the official macOS app from tailscale.com/download, open it, and sign in.
If you prefer Homebrew:
1brew install --cask tailscaleOpen Tailscale and log in with the same account you will use on the iPhone. Then verify that the Mac is connected:
1tailscale status
2tailscale ip -4The second command should return a private Tailscale address in the 100.x.y.z range.
You can also use the Mac's MagicDNS hostname instead of its IP address. In the Tailscale admin console, give the Mac a short, recognizable device name such as home-mac.
Open:
System Settings → General → Sharing → Remote Login
Turn it on and restrict access to Only these users. Select the macOS account that will run your development jobs.
From Terminal, confirm the current user and SSH setting:
1whoami
2sudo systemsetup -getremoteloginThe value from whoami is your SSH username. It is your local macOS account name, not your Apple ID email address.
If you prefer the command line, enable Remote Login with:
1sudo systemsetup -setremotelogin onBefore involving the iPhone, test SSH from another computer that is already on your tailnet:
1ssh YOUR_MAC_USERNAME@100.x.y.zReplace both placeholders. If this works, the Mac-side configuration is ready.
Install tmux with Homebrew:
1brew install tmux
2tmux -VCreate or reattach to one named session:
1tmux new-session -A -s mainInside tmux, start a job:
1npm run buildTo leave the session running while disconnecting SSH, press:
Ctrl-b, then d
That is tmux's default detach shortcut. The process keeps running on the Mac.
Reconnect later with:
1tmux attach -t mainYou can list sessions if you forget the name:
1tmux lsA disconnected SSH client does not stop tmux, but macOS sleep can stop network access or pause your workload.
Run a command through caffeinate when the Mac must stay awake:
1caffeinate -dimsu npm run buildFor a long-running coding agent:
1caffeinate -dimsu ./run-agent.shIf the command exits, caffeinate exits too. This avoids changing permanent power settings just for one job. Make sure the Mac is plugged in and has enough disk space and memory for the workload.
Install Tailscale from the App Store and sign in with the same account as the Mac. Turn the VPN on and confirm the Mac appears as an online device.
Then install an SSH client.
Create a new host with:
| Field | Value |
|---|---|
| Alias | Home Mac |
| Hostname | The Mac's Tailscale IP or MagicDNS name |
| Port | 22 |
| Username | The value from whoami |
| Authentication | SSH key, recommended |
For a first test, password authentication also works. Use the Mac's local login password—not necessarily the password for your Apple ID.
Once connected:
1tmux new-session -A -s mainYou now have a persistent remote development terminal in your pocket.
Password login is convenient for the first test, but an Ed25519 key is a better daily setup.
Create an Ed25519 key in Termius or Blink and copy its public key. On the Mac, add it to authorized_keys:
1mkdir -p ~/.ssh
2chmod 700 ~/.ssh
3touch ~/.ssh/authorized_keys
4chmod 600 ~/.ssh/authorized_keys
5nano ~/.ssh/authorized_keysPaste the public key as one complete line, save, and reconnect using that key.
Do not disable password authentication until key login has been tested successfully. Keep a second recovery path available in case the key is pasted incorrectly.
Tailscale SSH can manage SSH authentication and authorization through your tailnet policy. It is useful when you want identity-based access instead of distributing SSH keys.
On macOS, the Tailscale SSH server requires the open-source tailscaled variant; the sandboxed App Store build cannot act as a Tailscale SSH server. For a standard personal Mac setup, regular macOS SSH over the Tailscale network is usually simpler and already avoids exposing port 22 publicly.
Read the current requirements in the Tailscale SSH documentation before switching.
Sign in on the Mac and iPhone with the same Tailscale account. On the Mac:
1tailscale up
2tailscale statusCheck that Remote Login is enabled:
1sudo systemsetup -getremoteloginIt should report "Remote Login: On". Also confirm that you are using the Mac's Tailscale IP, not its local Wi-Fi address.
From another tailnet device:
1tailscale ping home-macIf the ping fails, check that both Tailscale apps are active and that the Mac is awake.
List existing sessions:
1tmux lsIf none exist, create one:
1tmux new-session -s mainMake sure it was started inside tmux. For jobs that require the Mac to remain awake, run them through caffeinate:
1caffeinate -dimsu your-commandThe result is a small, private, and inexpensive personal server: your Mac stays at home, while your terminal travels with you.
Further reading: Tailscale SSH, Tailscale on macOS, and tmux.
Related
AI Agent DevKit is a lightweight workflow for reliable AI-assisted development: focused skills, approval-gated planning, systematic debugging, an Obsidian-friendly source-grounded wiki, and optional OpenEZ code intelligence.
AI AI Engineering from Scratch is a self-directed repository curriculum that pairs lessons with buildable artifacts. It can structure study, but learners still need to choose a pace, verify understanding, and seek real project feedback.
AI Anthropic built Scion for an always-online monorepo with tens of thousands of daily code changes and millions of CI checkouts. Its architecture is a useful case study in scale, not a general call to replace Git.
AI A personal Codex log showed explicitly selected subagent models despite a different configured default. The case illustrates config precedence and why quota usage should be monitored, without claiming a universal token-cost ratio.
AI A decision model answers predefined typed questions about a state, while a generative LLM produces text token by token. These approaches solve different parts of an application and can be combined.