I got way too excited when I figured this one out – it’s possible to connect to your Mac using your iPhone, have the display show up on the monitor or TV and use the iPhone (or a bluetooth keyboard) to control it. Sounds great for weekends away or emergencies when you desperately need to get onto your main machine but are out and about. There are apps out there which will apparenly do this with “minimal setup” but I wanted a solution which didn’t involve being piggy-backed through other people’s servers, and which also utilised SSH for maximum security (what with all my state secrets, etc.). This post sets out to clarify the basic steps involved, referring to existing in-depth guides where required rather than re-hashing perfectly good info.
1) Set up SSH on your Mac
This step involves securing your SSH setup as much as possible, including altering some settings and changing the default port so that there’s less chance of someone getting into your system just by checking the default. You can choose yourself a port from 49152 upwards, according to the IANA port spec. (upper limit is 65535). Although you can use private keys to provide password-less login in some SSH clients, bear in mind that VNC clients mightn’t be as advanced and probably want password authentication instead. I’d leave PasswordAuthentication set to yes in sshd_config until you know the capabilities of your chosen VNC client.
2) Enable SSH on your Mac
Basically just tick the “Remote Login” option of the “Sharing” panel in System Preferences. Don’t forget you may need to fiddle around with the firewall a bit.
3) Check it works
Use a machine on the same network (or an iPhone SSH client like TouchTerm over your own wi-fi) to SSH into your Mac, ensuring you use the -p switch to specify the secret port you chose in Step 1.

4) Set up your router
Select a random port to use with SSH when connecting from outside your local network (again, just so you’re not using the default). Set up your router to translate this port number to the new secret internal port number you chose in Step 1, and to forward all of this traffic to your Mac. This ensures all traffic sent to the secret external port is forwarded to the secret internal port, on the machine you want to connect to. Ostensibly there’s no need to do this, but I figure that it’s more secure than using the default ports and it’s not hard to do, so worth setting up. I set up the port translation and forwarding on a BT Home Hub in the Advanced Settings > Application Sharing > Supported Applications screen and it was very easy – see screenshot below.

5) Check it works
Use a machine outside the network (or an iPhone SSH client like TouchTerm over 3G or EDGE) to SSH into to your Mac, ensuring you use the -p switch to specify the secret port you chose in Step 4.
6) Select an iPhone VPN client
I chose Jaadu VNC on the basis of good reviews, and the fact that it supports SSH connections, multiple displays, and the iPad VGA cable (which also works on the iPhone 4). At £15 it’s by far the most expensive iPhone app I’ve bought so far, but absolutely worth it. If you’ve got an iPad it’ll run on that too.
7) Test an unsecure connection
I first connected to my Mac from the iPhone without any encryption, on the default VPN port of 5900. You may have to set your router to forward all traffic from port 5900 to your Mac in order for this to work. Once you’ve established it’s all working, you can remove the port forwarding again, on the basis that we’ll be connecting over SSH in future and so nothing will be shifted through 5900.

8) Test a secure connection
The final step is to connect with the SSH options set up in the VNC client. Remember that you’ll need to tell the client to use the custom external SSH port that you chose in Step 4, rather than the default of 22. In Jaadu this wasn’t too tricky; they have detailed help pages which describe how to set up encryption, whether you’re using their client software or not. I’ve included shots of the two crucial Jaadu setup screens below:

What if my Mac’s turned off?
Obviously all of the above requires your machine to be turned on. There are two options here, one low-tech and one high-tech. The low-tech one is to get someone who’s at home to turn the machine on each time you need it (or just alter your power saving options so it stays on all the time). The high-tech way is to use Wake-on-LAN over the internet to wake your Mac from sleep mode each time you want to use it. Thankfully someone’s made an App or several to do just that.
You’ll need to follow the rules for working with WOL, i.e. your Mac must support it and have the “Wake for ethernet network administrator access” box ticked in the Energy Saver pane of System Preferences. If you want to use WOL from outside your own network, you’ll also need to set up your router to forward all traffic on the relevant port(s) – usually UDP 7 or 9 – to the Mac you want to wake up. As with SSH, it’s possible to use a random port from outside for security, and translate that to UDP 7 or 9 using your router. App-wise, I tried RemoteBoot Lite but couldn’t make it wake the Mac (although I should point out I didn’t email the developers for help). The free NetAwake did work straight away, and served to prove that my MacBook could be turned on with WOL. However, the lack of features (it is free) meant I went for iNet WOL in the end. It’s well designed, and for each machine you can set LAN and Internet addresses, which is convenient. You can specify what port to connect to, and can also give SSH login details which allows you to sleep and turn off your Mac remotely too. Well worth £1.19 of your hard-earned cash, in my opinion.
Displaying the Output on a Monitor or TV
The iPhone can use the iPad VGA cable to output video at 1024 x 768 (more background here). Unfortunately it doesn’t just mirror what’s on the display at any given time; you’ll need to find apps which support it. In Jaadu VNC, you can just connect the cable and the display pops up on the monitor or TV a couple of seconds later. There are other programs out there which can use the VGA output, mostly relating to giving presentations. Hopefully people will think of more creative ways to use it in the future.
[UPDATE: Apple has just released an adapter which lets you mirror the iPhone screen on a TV using an HDMI connection. So it now includes sound and is easier to use!]
Finally, some notes on Jaadu
Jaadu has proved an excellent purchase, but there are some things to be aware of. Firstly, their instructions imply that you need to download and install the VINE-Jaadu VNC server on your Mac, and then another utility, rather than use the built-in Screen Sharing service. This isn’t strictly true; they do provide instructions on connecting without the VINE server as well, but there are some differences between the two approaches. They’re outlined on this page. Secondly, if you do use their client then you’ll need a Gmail login and all your traffic will be routed (presumably not using SSH?) through Google’s cloud servers. If you want to set up your connections yourself, ignore the Gmail login screen when you first start the app, and head to the “Manual” tab.