Stop iTunes from auto-opening, control Spotify with your headphones, and realize all of your dreams.

Brian Gerson
Jul 17, 2016 · 4 min read

In Apple’s perfect world, you’d never run into the problem I’m going to help you solve.

You would listen to music on your Macbook Pro, on the iTunes platform, through Apple headphones. And then, when you wanted to pause a song or skip a track, you’d have options: use the media buttons on your Magic Keyboard, your laptop keyboard, or the inline controls on your earbuds.

But that’s not how I work. And, since you’re reading this, it’s probably not how you work either.

My setup includes a Das Keyboard (no media control buttons) and a pair of Bose QC25 headphones with inline mic and controls. I also use Spotify. Needless to say, I was not super pumped on the fact that even accidentally pushing the play button on my headphones would open up iTunes, even if I was listening to Spotify already. Luckily, I was able to pull together a few resources and solve my problem, so I figured I’d put them all together here, in this helpful Medium post. You are so welcome.

So, let’s set up your system.

Problem 1: Stop iTunes’ dictatorship over your media controls.

Whether you’re using your media keys on the keyboard or the inline controls on your headphones, nothing is worse than expecting to hear the sweet, sweet sound of whatever you listen to, and instead seeing iTunes pop up in your dock.

Two ways to approach this:

Short and simple. This is the approach I went with. If you’re comfortable using the terminal, it’s as simple as this: copy and paste the following line:

launchctl unload -w /System/Library/LaunchAgents/

If you’ve never used the terminal before, just press Command + Space Bar, type ‘terminal’, and hit enter. You can then copy the above into the window that opens up, then hit enter again. Done!

Important note: This will stop your remote control devices from working in general, i.e. your headphone volume buttons won’t function now. But we can easily solve that in the next section!

Also short and simple. I didn’t try this, but it seems like a well-maintained patch. Just install the Play Button iTunes Patch, which will stop the launch but retain the media key’s functionalities while the application is already running. You won’t lose remote control functionality, from my understanding, either.

Problem 2: Add New Control Functionalities

This part was really satisfying. You’ll need to download a program, but I promise you’ll only need to use it once— just set it and forget it, as they say.

So, once you’re ready, snag ControllerMate. Look familiar? It’s essentially a block-based GUI for creating simple programs. Which means that anyone can use it, regardless of your comfort with “programming”.

If you are using Spotify and want to use your headphones to control it, here is a file you can simply plug and play. Just open ControllerMate, import that file, and make sure it’s enabled by checking the box in the left-side menu.

It looks like this:

Now, what’s nice is, you can set up pretty much anything to work like this. Would you rather that your controller’s ‘volume up’ button skipped a track? Just create a new block, using the “AppleScript” option:

Once you have the block waiting, you can give it behavior by selecting ‘Store Script in Building Block’ and giving it a simple command:

Want to learn more about AppleScript? Go for it! But you don’t need to know much more than that to get going with customizing how your controls interact with your media player.

Of course, once you have enabled your ControllerMate scripts, you can just quit out and everything should work. Magic.

So go forth, experiment. I have my custom keyboard controls setup as well, and I am not exaggerating when I say I felt real, legitimate pleasure at simply controlling my media applications how I want to, rather than how Apple assumed I wanted to.

Comment with questions or suggestions if you got em!

Brian Gerson

Written by

Solver of problems. Brewer of beers. Befriender of dogs. Bike tourist and giant baseball nerd. Driven human being.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade