How to SSH into Mac from iPhone using Tailscale
Setting up SSH access from iPhone to Mac for LLM CLI capabilities through Tailscale
How to SSH into Mac from iPhone using Tailscale
Motivation
I saw some posts about how to SSH into Mac from iPhone to use Claude Code. I tried it out last month ~ it was fun ~ so I set it up with my new Tailscale network.
Tailscale gives you a mesh network for all your devices - check out the docs linked here --> https://tailscale.com/kb
Steps
- Install Tailscale on your Mac and Set up Tailscale and log in.
- Install/Login Tailscale on your iPhone
- Install Termius on your iPhone and connect to your Mac via SSH.
Install Tailscale on Mac
The tailscale provides three ways to install Tailscale on Mac: Standalone variant, App Store variant, and Open Source variant. In short, you need to install Open Source variant to ssh into your Mac. I need to look into it to understand the reason, but the Mac has a restriction to run the deamon process from the desktop app, so you need to run the Open Source variant to run the deamon process.
Note: as described in the tailscale documentation, you could not use the GUI app. So you should be comfortable with the command line interface.
You can install the application as described in the Tailscaled on macOS.
Docs - https://github.com/tailscale/tailscale/wiki/Tailscaled-on-macOS
go install tailscale.com/cmd/tailscale{,d}@main
After installing, you can run the following command to install the system daemon:
sudo $HOME/go/bin/tailscaled install-system-daemon
tailscale up
tailscale status
tailscale set --ssh
Install Tailscale on iPhone
Install the Tailscale app from the App Store on your iPhone and log in with the same account you used on your Mac. You can see two devices connected to the same Tailscale network, which is called tailnet.
Install Termius on your iPhone and connect to your Mac via SSH
As a SSH client, I used Termius. You can install it from the App Store on your iPhone.
In Termius, you can add a new host by tapping the "+" button in Vault tab. Enter the following information:
- Label: Whatever you want to name to identify the host (e.g., "My Macbook Pro")
- Hostname: The Tailscale IP address of your Mac or the hostname that publishes by Tailscale (e.g., "my-macbook-pro.ts.net")
- Username: Your Mac username. You can find it by running whoami command on your Mac.
- Password: Your Mac password.
Comparison to GUI version
Compared to the GUI version of Tailscale, running tailscaled instead has the following differences:
tailscaled on macOS is less tested.
the App Store version uses the Apple Network Extension API; tailscaled uses the /dev/utun TUN interface MagicDNS works, but you need to set 100.100.100.100 as your DNS server yourself. It doesn't change your DNS config. tailscaled can run at system boot before any user has logged in (e.g. letting you VNC to your computer after a power outage) is fully open source (Tailscale GUI parts aren't open source on non-free operating systems) Refer to the comparison available in the Tailscale KB for more details.
Have Fun ~~ Willy