How to SSH from your iPhone to your Mac
Most guides stop at "type your password into an app". Here is the whole path: setup, keys, a session that survives your phone locking, and getting in from outside your house without opening your router to the world.
Short answer: To SSH from an iPhone to a Mac, turn on Remote Login in System Settings under General, then Sharing, install an iPhone SSH client such as Termius or Blink Shell, and connect to [email protected] on port 22. If all you want is to check on or answer a coding agent, MightyMouse shows your Mac screen and keyboard in iPhone Safari with no SSH setup.
This takes about ten minutes the first time. The Mac must be awake and on, and for the first connection your iPhone must be on the same Wi-Fi. Away from home comes later, and it is the part most guides get wrong.
Step 1: turn on Remote Login on the Mac
Your Mac already contains an SSH server. It is just switched off. Apple documents the switch on its support page, Allow a remote computer to access your Mac (checked October 2026).
- Open System Settings from the Apple menu.
- Click General in the sidebar, then Sharing. You may need to scroll down.
- Click the Info button next to Remote Login and turn it on.
- Open the Allow access for menu. Pick Only these users and add just your own account. This is the cheapest safety step on the whole page.
- Read the ssh command Apple shows under "Remote Login: On". That line is the address you will type into the iPhone.
Apple adds its own warning on that page: turning on Remote Login can make your Mac less secure. Keep that in mind for the "away from home" step.
Step 2: find your Mac and your username
You need two things: where your Mac is, and who you are on it.
- Username. In Terminal on the Mac, run
whoami. That short name is your SSH username. It is often not the full name you see on the login screen. - Address. Use the
.localname from the ssh command in Sharing, for exampleroys-macbook.local. It keeps working when your router hands the Mac a new IP. The fallback is the IP address under Wi-Fi in System Settings, then Details.
Step 3: pick an iPhone SSH client
Two clients come up in nearly every search for this. Prices below are from their App Store listings as of October 2026 and they change, so check the listing before you buy.
- Termius. Free to download with in-app purchases. The listing says the free Starter plan includes SSH keys generated in the Secure Enclave, plus Mosh and SFTP. Syncing across devices is part of Termius Pro, listed at $15 a month or $119 a year. This is the free route to "SSH from iPhone free", and for one Mac it is enough.
- Blink Shell. Free to download with a 14-day free trial, then paid. The listing shows Blink+ at $19.99. It is built on Mosh and SSH, supports ED25519 keys and the Secure Enclave, and lists hardware-keyboard remapping. People who live in a terminal tend to prefer it.
In either app, add a new host: your .local name, port 22, your username, and your Mac password for now. The first time you connect, the app shows the Mac's host key fingerprint. Accept it once. If it ever changes later without you reinstalling anything, stop and find out why.
Step 4: switch from your password to a key
A password works, but every login types it on a glass keyboard, and a password on an SSH port is what automated scanners guess at. A key fixes both.
- In the app, generate a new key. Both apps do this in their key section. Name it something like "iphone".
- Copy the public key. Never copy or share the private one.
- On the Mac, run
mkdir -p ~/.ssh && chmod 700 ~/.ssh, then paste the public key as one new line at the end of~/.ssh/authorized_keys, then runchmod 600 ~/.ssh/authorized_keys. - In the app, set that host to use the key and connect. No password prompt means it worked.
Only after the key works, you can turn passwords off. Check that /etc/ssh/sshd_config includes the sshd_config.d folder, add a file there containing PasswordAuthentication no, and keep your current connection open while you test a second one. If you lock yourself out, the fix is sitting at the Mac.
Step 5: use tmux so locking your phone does not kill the work
This is the step guides skip, and it is the one that matters for a phone. iOS suspends an app soon after you lock the screen or switch away, and a plain SSH connection dies with it. Whatever was running in that window dies too, including a long build or a coding agent.
tmux fixes it by keeping the shell running on the Mac, whether or not your phone is connected. Install it once with Homebrew, then use it every time.
- On the Mac:
brew install tmux. - Over SSH, start a named workspace:
tmux new -s work. Run your command inside it. - Leave without stopping anything: press
Ctrl-b, thend. Or just lock the phone. The work keeps going. - Come back from any device:
tmux attach -t work.
Mosh, which both apps list, goes further. It keeps the connection itself alive across Wi-Fi changes and sleep, but it needs mosh installed on the Mac too. Many people use tmux alone and just reconnect.
Step 6: reaching your Mac away from home, safely
The .local name only works on your own network. The tempting fix is to forward port 22 on your router to the Mac. Do not do that. It puts your Mac's login prompt in front of the entire internet, and scanners will find it within hours. Even with keys, you are now one bug away from a stranger.
The safe pattern is a private network between your own devices. Tailscale is the common choice. You install its client on the Mac and the iPhone and sign in to the same account, which puts both on a private network Tailscale calls a tailnet. Per Tailscale's docs, MagicDNS lets you reach each device by name, and the personal plan includes six free users (checked October 2026). Then you point your SSH app at the Mac's Tailscale name instead of the .local name. Port 22 stays closed to everyone else.
Tailscale also has its own SSH feature, but its SSH docs say the server side on macOS needs the open-source tailscaled variant, not the standard Mac app. The normal Remote Login you turned on in Step 1 keeps working over Tailscale with no changes.
One more limit that no tool removes: a sleeping Mac does not answer. Keep it awake while you are out, for example with caffeinate in Terminal. Waking a sleeping Mac is its own topic, covered in waking your Mac remotely.
Do you actually need SSH?
SSH is the right tool if you want a real shell: moving files, editing config, running scripts, starting a long job. If you are on a Mac mini with no screen attached, it is how most people run it, as covered in running a Mac mini without a monitor.
But a lot of people searching this are doing one small thing. They started Claude Code or Codex on the Mac, walked away, and want to see whether it is stuck or answer a question it asked. For that, SSH is a lot of setup: Remote Login, keys, tmux, a private network, and then typing on a phone keyboard into a terminal. See running Claude Code from an iPhone for the general picture.
MightyMouse turns your iPhone into a live screen, trackpad and keyboard for your Mac, with nothing to enable on the Mac except the app. You scan a QR code from the app's Settings and a control page opens in iPhone Safari. From there you can mirror the Mac screen to watch the terminal and type into whatever is focused. Away from home it connects through a tunnel the app sets up for itself, so there is no router setting and no port to open.
The second half matters more for agents. When the agent is set up with the mightymouse-code tools, its questions and approval requests arrive on your iPhone as a notification. You answer without opening anything: tap one of the agent's own options or type a reply. Approvals ask for Face ID or your passcode first, so someone holding your locked phone cannot say yes for you, while declining needs nothing. The agent waits for your answer in the meantime. That setup is in approving an agent from the lock screen and coding agents from your phone.
What this costs you, and where each one falls short
- A phone keyboard in a terminal is painful either way. Pipes, dashes, tabs and arrow keys are slow to type on glass. Blink and Termius add extra key rows and hardware keyboard support. MightyMouse gives you the Mac's real keyboard input, but you are still typing on a phone. For long commands, a voice note into dictation that works over SSH or the iPhone as a keyboard for your Mac helps.
- MightyMouse is Mac only, and it needs the Mac app running and the Mac awake. It cannot reach a sleeping Mac or get past a locked screen. SSH to a Linux box or a Raspberry Pi is not something it does.
- The agent messages are cards, not a live feed. You get notify, ask and approve cards. A recap only updates the session's one-line summary and sends no notification. You do not get a token-by-token tail of the terminal. If you want to watch output scroll, open the mirrored screen or use SSH with tmux.
- Lock-screen answers need the MightyMouse iPhone app, not just Safari, and the agent has to be connected to it. Plain Safari gives you the screen and keyboard, not the notifications.
- SSH costs more of your time and attention. The apps have free tiers, but you own the keys, the tmux habit and the network. If the job is a quick check, that is a lot to carry.
- Away from home is not unlimited for free in MightyMouse. On your own Wi-Fi it is free and unlimited. Over the tunnel there is a free allowance of minutes, then it needs a paid plan. Check the app for the current numbers.
A quick way to choose
- Moving files, editing config, running scripts, administering a headless Mac: use SSH, with keys, tmux and Tailscale.
- Seeing whether a coding agent finished, or answering its question from the couch or the lock screen: use MightyMouse.
- Both: they do not conflict. Keep Remote Login for the shell and use MightyMouse for the quick checks. More on this split is in running any terminal agent from your phone.
Check on your coding agent from your phone, with no SSH to set up.
Free on your own Wi-Fi. Mac only.
Common questions
How do I SSH from my iPhone to my Mac?
Turn on Remote Login in System Settings under General, then Sharing. Install an SSH client such as Termius or Blink Shell on the iPhone, add a host with your Mac's .local name, port 22 and your Mac username, and sign in with your password or an SSH key. Both devices need to be on the same Wi-Fi unless you use a private network such as Tailscale.
Can I SSH from my iPhone for free?
Yes, for a single Mac. Termius is free to download and its App Store listing says the free plan includes SSH keys, Mosh and SFTP, with syncing in the paid Pro plan (as of October 2026). Blink Shell is free to download with a 14-day trial and is paid after that. Check the App Store listings, since prices change.
Is it safe to forward port 22 to SSH into my Mac from outside?
It is not a good idea. Forwarding port 22 exposes your Mac's login to the whole internet, where automated scanners probe it constantly. A private network such as Tailscale lets your iPhone reach the Mac without opening any port to the public.
How do I keep an SSH session alive when my iPhone locks?
Run your work inside tmux on the Mac. iOS suspends the SSH app after you lock the phone, which drops the connection, but tmux keeps the shell and anything running in it going on the Mac. Reconnect and run tmux attach to pick up where you left off. Mosh, which Termius and Blink both list, also helps with dropped connections.
Can I SSH into a Mac that is asleep?
Generally no. A sleeping Mac does not answer SSH, so keep it awake while you are away, for example with the caffeinate command or a power setting that prevents sleep. This limit applies to every remote tool, including MightyMouse.
Can I check on Claude Code from my iPhone without SSH?
Yes. MightyMouse shows your Mac screen and keyboard in iPhone Safari, and an agent connected to it can send questions and approval requests to your iPhone as notifications you answer from the lock screen. It is Mac only and needs the Mac app running and the Mac awake.
If you just need to see your terminal and answer your agent, MightyMouse puts your Mac screen, keyboard and agent questions on your iPhone without opening a single port.