MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Apple TV: State of the Hacks

by Erica Sadun
04/02/2007

In the two weeks since Apple TV shipped, an amazing array of hacks has been published around the Web. In addition to the usual suspects like the Make blog, brand new sites including AwkwardTV and Apple TV Hacks detail the various mods and hacks available to Apple TV owners. So what are these hacks, how successful are they, and what kind of skills do you need to implement them? In this State of the Hacks roundup, you'll discover what kinds of mods are out there and whether they're the right fit for your needs and abilities.

What Is Apple TV?

Apple TV, as you're probably aware, is Apple's new set-top video unit (Figure 1). It allows you to sync content to, or stream content from, iTunes. In some ways it's like a souped-up iPod. Like an iPod, you can store music, pictures, and video on it. You can play this content back while relaxing on the couch in your living room. And, in a capability that goes beyond iPod, you can select up to five different iTunes libraries from your wireless network and stream content from those libraries to your TV without having to synchronize. This is a great feature for things you only want to watch or listen to once, and you don't take up any of your unit's minimal thirty-odd gigabytes of free space. Consider that most iTunes movies are around a gigabyte in size. Each. Those thirty-something gigabytes can get used up real fast.

Figure 1
Figure 1. Apple TV moves digital media away from your computer and into your living room.

As with the iPod, using Apple TV is like using iTunes but with a simpler interface. You pick the content with your Apple remote, and Apple TV plays it for you. There aren't a lot of options; there aren't a lot of details. Apple TV moves your media out of your office, away from your computer, and into the rooms you normally spend time in while doing non-computer things in your life: your living room, your kitchen, your den, and so forth. It's just like how an iPod moves your media into your pocket.

But it's what hidden under Apple TV's simple hood that's getting hackers excited. Amazingly easy to mod, Apple TV offers you a customizable $299 OS X computer, complete with TV-compatible graphics and wireless networking. Sure, you could go out and probably buy a used Mac Mini for nearly the same price, but you'd miss out on a lot of the hacking fun. Besides, it's more the challenge than the built-in capabilities that makes this a great modding platform. And here are the ways you can mod it.

Cracking the Case

All the software mods in existence won't give you the sheer visceral thrill of physically cracking open a case to see what's inside. Apple has made it especially easy to open its case and access the 2.5" PATA hard drive inside. Yes, sure, you may violate your warranty, but when has that stopped a determined explorer? All you need is a couple of TORX screwdrivers (size T10 and T9) and an optional putty knife.

Unplug your Apple TV, let it cool down, turn it upside down, and peel off the rubber backing (Figure 2). You might want to use a putty knife to help peel because the glued-on backing can rip during this process.

Figure 2
Figure 2. The rubber backing does not peel off cleanly. Expect a bit of mess from the adhesive.

Underneath, the back panel has eight TORX-style screws. The four on the outside hold the back to the Apple TV unit. The four inner ones hold the hard drive onto the back panel. Use the T10 screwdriver to remove the four outer screws. There are two long and two short ones. Use the T9 screwdriver to remove the four short screws holding on the hard drive.

Gently pry open the case. The hard drive will remain attached to the back panel, and a ribbon cable connects the hard drive to the main unit (Figure 3). Carefully remove the hard drive from the panel (it's held on by a sticky backing), and then detach the ribbon cable from the hard drive.

This leaves you with a ventilated back panel, a hard drive, and the main Apple TV case containing the rest of the electronics. It also puts you in a position to start modding. Cracking your case is the prerequisite for pretty much every mod out there.

Figure 3
Figure 3. Inside the Apple TV case.

Upgrade Your Apple TV Hard Drive

You can google up many Apple TV hard drive upgrade tutorials around the Net these days. Some of the best include the ones from Apple TVHacks, Engadget, and MacWorld. So why would you want to upgrade your hard drive? Beyond the fact that the upgrade gives you lots more space (Figure 4), it also allows you to continue using your Apple TV as an Apple TV but a better Apple TV. If your goal is simply to improve your unit so it can store more of your iTunes library, the hard drive upgrade is a great route. You don't mess with the underlying software or operating system. Instead you clone to a larger drive.

To perform this hack, it's best if you feel comfortable at the Unix command line, but several of these tutorials offer software-driven alternatives. You do have to pay for the privilege. GUI tools to copy your drive and update your partition sizes could set you back another $100. The command-line alternatives are free with OS X.

There are, of course, possible pitfalls along the way. First, don't use just any off-the-shelf 2.5" hard drive enclosure. You need to make absolutely sure your enclosure plays nicely with OS X. Yes, I learned this the very hard, and very slow, way. If your drive suddenly starts freezing up during data transfers and your data transfer rate is mind-bogglingly slow, your enclosure may be at fault. Most of the tutorials suggest you use the Unix command-line dd data duplication utility to copy your drive. You can track a dd's progress. Issue a ps -ax command and note the dd's process ID. Enter a "kill -s INFO pid" command, and dd reports the progress to date.

Second, keep this an Intel-only operation. Do not connect your hard drive to a G4 machine. You may mess up the GUID partition table. The basis for this warning is more anecdotal than anything else but where your $300 investment is concerned, better safe than sorry.

Figure 4
Figure 4. You can find any number of tutorials around the Web that show you how to upgrade your Apple TV drive for greater storage capacity.

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.

Copyright © 2009 O'Reilly Media, Inc.