Image for post
Image for post

How to Connect Your AirPods to Your Mac with a Keyboard Shortcut

Josh Johnson
Sep 22, 2017 · 4 min read

On the first day that I owned my Apple AirPods, they would connect to my Mac as soon as I put them in my ears. They don’t do that anymore. Now, I have to click on the bluetooth menu in the menu bar and connect them manually… each time I take them out of the case. This is no good. I’m far too lazy to carry on like this, so I figured out how to connect my AirPods with a keyboard shortcut. Read on to learn how.


This is Easier Than You Think

Fair warning: if you scroll through the steps below, this seems like a long process, but that’s just because I went into every little detail. If you know your way around a Mac, this will take five minutes or less. All you have to do is , change one line to add in the name of your AirPods, make sure the script has accessibility permissions, and then assign the script a keyboard shortcut. That’s it. If you know how to do that stuff, you can close this tab now and get to it.


Part 1: AppleScript

Don’t be afraid! You don’t have to actually write any AppleScript. We can steal everything we need from Andrew Burns, who created and shared . Thanks Andrew!

1. Open Script Editor

This is the application for creating and running AppleScripts. It is found in your Utilities folder, but you can just use Alfred or Spotlight to bring it up quickly.

Image for post
Image for post
Toss in the name of your AirPods and you’re done

2. Paste in Andrew’s Script and Customize

You can do this. To begin, just copy , then paste it into Script Editor. To make this work for your AirPods, you’ll need to edit a single line of his code. Find this bit: tell (menu item "SX-991" of menu 1).

Replace SX-991 with the name of your AirPods. It’s important to note that you have to get the name of your AirPods precisely correct, down to the apostrophe. This little gem tripped me up and it will throw an error for you too if you don’t get it right:

Image for post
Image for post
Syntax matters!

3. Save As an Application

You’re done with the ApplScript part! See, I told you it was easy. Now save your work. In the save dialog, choose “Application” as your File Format. I called my application, “ConnectToAirpods” and dropped it into my Applications folder.

Image for post
Image for post
Save as an Application

Part 2: Accessibility Preferences

If you run your script, you’ll notice that it won’t actually work. That’s because you have to give it permission to control your computer. To fix this, do the following:

  1. Go to “Security & Privacy” in System Preferences
  2. Click the little lock to make changes.
  3. Select “Accessibility” from the list of items on the left.
  4. Hit the little + button
  5. Find your app and add it
Image for post
Image for post

Part 3: Create the Keyboard Shortcut

You now have the key component: an app that will connect your Mac to your AirPods. Now for the tricky part: how do you launch an app with a keyboard shortcut? There are quite a few ways to do this. Pick your poison:

  1. (written by yours truly way back in 2012… I think it still works). Difficulty: super nerd. It’s a lot of hassle, but doesn’t require any third party tools.
  2. Install a free keyboard shortcut launcher like . Difficulty: n00b. Anyone can do this.
  3. Build a quick workflow. Difficulty: moderate. You’ll need the Alfred Powerpack, which isn’t free. That being said, Alfred is amazing and the team behind it is friendly and hardworking. I think you should use Alfred and buy the Powerpack. Supporting great app developers is good for your soul.

For those that choose the Alfred route, here’s how it works…

1. Create a Workflow:

Open Alfred’s Preferences and go to the Workflow tab. Create a new workflow called Connect to AirPods.

Image for post
Image for post

2. Add a Hotkey trigger

Control-click on the worfklow canvas and select Triggers > Hotkey. Choose a keyboard shortcut to launch your app and hit save.

3. Add a Launch App Action

Click and drag from your trigger and select Actions > Launch Apps / Files. Then choose your application.

Image for post
Image for post
Your finished worfklow should look like this

You Did It!

Well done. I award you 100 nerd points. Apple didn’t give you the feature you wanted so you built it yourself. You’re a go getter.

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store