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. Read on for 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/Documents/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.
Nice post! Thanks for the mention
I am just a retired airline pilot that enjoys messing around with these computers. I have done your stuff as well as iMattUK’s stuff and it all appears to work. At first I though yours were two separate ways to achieve the VNC connection, but now I believe I realize that both sets of instructions work together. His to get it going initially and yours to keep it going.
My one nagging question… How come I can’t see a “Daemon” folder? I have manually placed a copy of “com.OSXvnc.plist” in the LaunchAgent folder as well as entered the commands in Terminal (I have a copy also resident in the desktop level of the AppleTV as seen via Cyberduck.. apparently that isn’t causing any harm..). I’m sure Agent and Daemon are totally different, but..
Anyway…it all works with aTV flash 3.4.3, and since I have a 250gb HD in my aTV, It doesn’t bother me having what I am sure is “clutter” lying around.
Thanks again for the instructions.
Hi Bill,
I can’t help you I’m afraid as I haven’t done the script steps myself but I just wanted to say that for a newbie you’re doing just fine! Most people wouldn’t dream of playing with the technology in the way you are, so you have my respect!
Hopefully arfore can help you out with your question.
Cheers,
Matt
@Bill Helsabeck: I am not sure why you don’t see that path on your AppleTV. As far as I can tell it has to be there since that is where the launchd plists from Apple and aTV live.
According to the Apple documentation at http://developer.apple.com/MacOsX/launchd.html you should not use the /System/Library level directories since that is “reserved for system-provided daemons”, however in my testing I could not get it to work consistently unless I placed it in the LaunchDaemons directory inside the /System/Library directory.
Andy
Thanks, worked Awesome! The only thing is, I can see the ATV main menu, but I cannot do anything with it, keyboard and mouse don’t do much. Any way around this? Thanks
Ed,
I never had any luck interacting with the FrontRow interface via VNC, of course this is not why I loaded it.
I use VNC to control Firefox when I am running it on the AppleTV. I use Firefox to view things like ABC and Fox since they aren’t available in Boxee yet for the AppleTV. Also, since Hulu isn’t available on Boxee anymore (unless you want to run the hacked Hulu plugin) it works great for watching Hulu.
I have also heard from others that you can use it for NetFlix but I haven’t tried that yet.
Andy
How do you get keyboard and mouse control?
You can get keyboard and mouse support by running the NitoTV SmartInstaller.
For more on that, check out the entry on the AwkwardTV wiki: http://wiki.awkwardtv.org/wiki/NitoTV_Take_2
Andy
Hiya, just picking up what I think is a typo… since you’ve done this:
SFTP/FTP/SCP the file to the DOCUMENTS directory in /Users/frontrow/ on the Apple TV
Shouldn’t the following line be…?
sudo cp /Users/frontrow/DOCUMENTS/com.OSXvnc.plist /System/Library/LaunchDaemons/
Capitals used for clarity only. Cheers, nice guide tho! Tnx
@Brett
Nice point. I have updated the page.
Andy
Hi there,
very clear and easy to follow the instructions – the only problem i have is that when I go to connect via Chicken of the VNC, I get the following message:
connection refused: connect ()
I’ve tried working through the process a couple of times, including entering the password in caps and lower case.
I’m using Apple TV software v.3.0.2
SSH works fine, and I can upload files etc.
I can’t seem to find any obvious way of finding out whether VNC is running on the AppleTV
Hey,
very good description, however I do get the following response for
./storepasswd YOURPASSWORD /Users/frontrow/vncpasswd
./storepasswd: Permission denied
What am I doing wrong?
I have an appleTV with 3.02
Raccoon
It Works!
Awesome.
However, for me it only shows a static image (whatever was on the screen at the time of connection). I have to restart the vnc session to get a refresh.
I’m connecting via Mac OS X 10.6 via Finder’s “Connect to Server” menu function: vnc://appletv.local