macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Apple TV: State of the Hacks
Pages: 1, 2

Enabling SSH Access

Do you want to run custom software and bypass Apple TV's built-in Front Row-like interface? SSH holds the key. If you want to play with your Apple TV and run software like VLC, Firefox, iTunes, QuickTime Player, and so forth, your first step is opening Apple TV to SSH.



The secret is simply this: Apple TV runs a stripped-down and customized version of OS X. If you know how to mod OS X, you know how to mod Apple TV. This hack lies strictly in Unix-command-line territory. If you don't feel comfortable at the command line, you won't feel comfortable performing this hack.

The hack goes like this. You connect your Apple TV drive to an Intel Mac. You then disable the Apple TV firewall and enable SSH by modifying the way Apple TV starts up. Tutorial Ninjas provides an excellent step-by-step tutorial that shows how to do this. The procedure involves creating a new startup item in Apple TV's System/Library/StartupItems folder that tells Apple TV to turn off the firewall; and you enable SSH by copying /usr/sbin/sshd from an Intel Mac, adding a launch daemon for it.

Once you make your mods, you reinstall the hard drive into your Apple TV unit and power it up. You'll probably have to walk through the whole "Pick a language," "Pick a TV resolution" process again before your unit gets around to actually launching the SSH daemon. Also, you'll want to visit your network settings to determine which IP address to connect to. After, just return to your wireless-enabled computer and issue an ssh command to connect to your modified unit--e.g., ssh -1 frontrow@192.168.0.106.

After connecting by SSH, your entire Apple TV OS opens up to you. You can enable VNC (these Tutorial Ninjas instructions show you how), mount the Apple Drives via AFP (instructions are on the Awkward TV wiki) and settle down to some serious Apple TV hacking (Figure 5).

Figure 5
Figure 5. After disabling the firewall and enabling SSH, I could enable VNC, connect to the Apple TV using Chicken of the VNC, and run non-standard software on the unit.

Adding Custom Plug-ins

If you've enabled SSH, and you want to take your Apple TV to the next level but still use it more or less as an actual Apple TV, custom plug-ins allow you to add features that Apple did not include in its standard UI. Several plug-ins have been published that add menu items to your main Apple TV menu, performing tasks like playing back files outside the iTunes hierarchy and quitting the Apple TV UI so you can enter hacking mode. (You must join the InsanelyMac forum to access this AppleTVCloser module.)

To install a module, drop it into Apple TV in its /System/Library/CoreServices/Finder.app/Contents/PlugIns folder and then relaunch Finder.app, which is actually the FrontRow-like UI and not the Finder you'd find on a standard OS X installation. When Finder.app relaunches, it will read the new plug-in along with its standard plug-ins (Movies, TV Shows, Music, Podcasts, etc.) and display it on its menu (Figure 6). To allow the Files plug-in to play back more movie formats, make sure to add Perian to /QuickTime/Library on Apple TV.

Figure 6
Figure 6. Custom plug-ins add new features to Apple TV's interface while retaining the standard features, options, and UI.

Disabling the Watchdog and Replacing Finder

The problem with Apple TV's Front Row-like interface is that it always wants to stay in front. And if you're a hacker, you'll probably want to hide it and run something else instead. Sure, you can try to kill it, but like a mythical creature (a golem or a vampire, perhaps) it keeps coming back to life again and again and again. To truly disable it, you need to perform the computer equivalent of wiping the magic word from its forehead or staking it through the heart. If you've enabled SSH and VNC, you've clearly mastered all the technical skills you need for this hack.

First, disable ripstop. Perform a ps -x, find out the process ID and just sudo kill -9 that process to death. Next, disable Watchdog. Perform a kextstat -b com.apple.driver.AppleTCOWatchdog. You'll see the Watchdog item listed. To remove it, issue sudo kextunload -b com.apple.driver.AppleTCOWatchdog. You should receive a "succeeded" message, and any subsequent kextstats will no longer list it. Finally, replace Finder.app. Go ahead and sudo mv Finder.app to FinderOrig.app or something like that, and replace it with any other application. I use QuickTime Player for no particular reason, but you can certainly replace it with another application like CenterStage, iTheater, or MediaCentral.

A few warnings, though. First, if you intend to power down your Apple TV, always return the original Finder.app before you power down--you may need some of its code to pick a language and a screen resolution for when you power back up. Second, you will need to unload the Watchdog kext and kill ripstop every time you reboot your unit--whether you do so by powering off or by issuing a shutdown -r now command. You can mess with your startup files to do so automatically, but I just do it by hand.

By disabling the default Finder, you can now run any program that's willing to work for you on your Apple TV. I am personally besotted with VLC and Joost. VLC even works with your Apple remote on your TV, and you can stream to it using the methods I laid out in my recent VLC streaming article. I had great success with live standard definition streaming over my 802.11g network (Figure 7) but not so much streaming DVD or High Def signals.

Figure 7
Figure 7. By disabling the standard Apple TV UI, I was able to run--and see--VLC. Here you see me streaming live video from my EyeTV tuner to my Apple TV as it recorded on my Mac Mini.

Running OS X

Apple TV runs a version of OS X and Front Row that's almost, but not quite, like the OS X and Front Row that runs on a standard Mac mini. So what's stopping you from running OS X directly on Apple TV? As of right now, nothing but a willingness to hack further than ever before. Over the weekend, AppleTV Hacks posted a way to run standard OS X directly on Apple TV. The hack comes courtesy of semthex of HackinT0sh.org, famed for his OSx86 contributions.

According to AppleTVHacks, semthex wrote a kernel processor emulation that allows Mac OS X to run on the Apple TV hardware. Mark of Mark's Geekly Ramblings, a tester, posted a video showing OS X running on his Apple TV. Check it out if you want to see it in action.

To perform this hack, you install OS X on your hard drive and then replace the mach_kernel with semthex's version. You must also add the boot.efi file from the original AppleTV drive, run the "bless" command on it, and delete all the NVidia-related kexts. After this, you reinstall your drive and boot your Apple TV into OS X. I have not yet had a chance to test out this hack, but it offers the promise of opening up your Apple TV to all the power of OS X at a bargain price.

Conclusions

In this article, you've seen how to crack open your Apple TV and start taking it to the next level. Although the hacks listed here represent the most important modifications currently available, they're certainly not all the hacks you can possibly achieve with Apple TV. It's a brilliant little machine and it's affordable--a not insignificant detail to anyone who wanted to start hacking but was afraid of the risks involved with a more expensive and less hacker-friendly unit. If the hacks discussed here intrigue you, jump on in, the water's fine--the hacks are easily accomplished and the state of Apple TV hacks is brilliant.

Thanks to Mark of Mark's Geekly Ramblings for his assistance with this article.

Erica Sadun has written, co-written, and contributed to almost two dozen books about technology, particularly in the areas of programming, digital video, and digital photography.


Return to the Mac DevCenter.