Over Thanksgiving break I bought an Apple TV. Like any good geek I wanted to expand the capability of the unit beyond the default setup.
After installing Firefox and getting USB keyboard and mouse support going, I realized that it would be tremendously cool if I could control it from my iPhone instead of using a wired keyboard.
To begin with I installed OSXvnc. The only problem was that I needed to store a password. After reading a the VNC post on the aTV Flash forum, I successfully conquered that. However, I had the same problem that iMattUK had: you had to use an ssh connection to start it.
To conquer this I wrote a launchd plist to launch OSXvnc for me at system startup. Below is the process I used to get it all working.
Install OSXvnc
- Download Vine Server (OSXvnc).
- SFTP/FTP/SCP Vine Server.app to the Documents directory in /Users/frontrow/ on the Apple TV.
- SSH to the Apple TV and run the following commands:
- cd Documents
- cd Vine\ Server.app
- ./storepasswd YOURPASSWORD /Users/frontrow/vncpasswd
- cp Contents/Resources/OSXvnc-server /Users/frontrow/Applications
Setup Autostart
This next part is a little complicated if you haven’t done it before. On OS X 10.4 Apple did away with the traditional Unix methods of starting daemons at system start. The new method they implemented is called launchd.
What you need to do is to create a launchd plist to start the VNC server. Since vi is not included on the Apple TV you will need to create this file on your computer and upload it.
Here’s the meaty content of my launchd plist:
<key>Label</key>
<string>com.arfore.VNC</string>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Users/frontrow/Applications/OSXvnc-server</string>
<string>-protocol</string>
<string>3.3</string>
<string>-rendezvous</string>
<string>Y</string>
<string>-rfbauth</string>
<string>/Users/frontrow/vncpasswd</string>
</array>
Here’s the entire plist:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>com.arfore.VNC</string>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Users/frontrow/Applications/OSXvnc-server</string>
<string>-protocol</string>
<string>3.3</string>
<string>-rendezvous</string>
<string>Y</string>
<string>-rfbauth</string>
<string>/Users/frontrow/vncpasswd</string>
</array>
</dict>
</plist>
Here’s how to put it in place:
- Take the text above and save it in a file called com.OSXvnc.plist
- SFTP/FTP/SCP the file to the Documents directory in /Users/frontrow/ on the Apple TV
- SSH into the Apple TV and run the following commands:
- sudo cp /Users/frontrow/com.OSXvnc.plist /System/Library/LaunchDaemons/
- sudo reboot
At this point your Apple TV will be rebooted. After it comes back up use the VNC viewer of your choice to connect to AppleTV.local on port 5900. You should see the screen.
This is not really useful to control the FrontRow interface, but it works great to control Firefox or EyeTV.
Thanks to iMattUK for the tip on storing the password for OSXvnc-server.
Update (2008-12-17): The problem that was plaguing Bill has to do with the difference between the filesystem view when using FTP vs. SFTP. When logging in via FTP you don’t actually get access to the whole filesystem. In order to access the /System/Library/LaunchDaemons/ directory you have to use SFTP.