Productivity

Free Your Mac's Media Keys From iTunes' Grasp

Nowadays, Mac keyboards have built-in media keys which can be quite handy — unless you want to use them with something other than iTunes. If you fall into that camp, here’s how to disassociate those keys with iTunes once and for all.

The problem is that, while some other media players have support for the media keys, Snow Leopard always links them with iTunes, causing iTunes to launch when you hit the play/pause button (Leopard does not have this issue). There are a number of ways to fix this. You can delete iTunes completely, including any copies on your backup disk, which is fine if you don’t use it (and if you change your mind, it’s easily reinstallable from Apple’s website). If you need to keep iTunes as a safety net, this won’t work though. Another option is keeping iTunes (in Music Store mode) or an empty Quicktime open in the background, but this is annoying and can be heavy on system resources. Thus, if you’re comfortable with it, the best method is to actually dig into the system files themselves.

You’ll need to use Terminal and Applescript Editor to pull this off, but it shouldn’t be too difficult. Open up a terminal window and type (or better yet, copy and paste) these three lines of code separately, hitting enter after each line and entering your password when prompted (note that it won’t show you your password as you type, but it is accepting the keystrokes).

cd /Applications/iTunes.app/Contents/MacOS

sudo mv iTunes iTunesX

sudo chmod uog+x iTunes

This renames a file within the iTunes app so it can’t launch. Of course, if you’re using this method, it means you still want to keep iTunes handy (perhaps your media player of choice draws from your iTunes Library), so you’ll have to make a quick script that will launch iTunes. Open up Applescript Editor and just copy and paste this code:

tell application “Finder”

try

set name of document file “iTunesX” of folder “MacOS” of folder “Contents” of application file “iTunes.app” of folder “Applications” of startup disk to “iTunes”

end try

tell application “iTunes” to activate

set name of document file “iTunes” of folder “MacOS” of folder “Contents” of application file “iTunes.app” of folder “Applications” of startup disk to “iTunesX”

end tell

Go to File and Save the script in your Applications folder (or wherever you want). Make sure the file format is “Application” so it is easily launchable, too. Then, when you want to open iTunes, just launch this tweaked application instead — iTunes will open right up.

Note that the original instructions at MakeUseOf used a different version of the 3rd Terminal command: sudo chmod uog+x iTunes instead of using iTunesX at the end. When I tested it, this line kept giving me an error saying that it couldn’t find the system file “iTunes”, which makes sense, because we had just renamed it to iTunesX. With my small change it worked like a charm for me; in fact, I tested the media keys with Songbird 1.4 and the Apple Media Key Support add-on. Note that the iTunes will do a quick bounce in the dock whenever you pressed play/pause (or, if iTunes isn’t in your dock, you’ll see your dock shift a little bit), though it didn’t open or interfere with the keys’ functionality. If you’ve got your own preferred method of working around this Snow Leopard “feature”, let us know in the comments!

Stop iTunes from Interfering with the Mac Media Keys [MakeUseOf]


Have you subscribed to Lifehacker Australia's email newsletter? You can also follow us on Facebook, Twitter and YouTube.