What is the Best way to do a macro to connect airpods easily - with keyboard maestro

Recently got keyboard maestro and I’m Loving it. trying to create a macro that when triggered by a string “.air” will change the sound source from the current audio source on os x to the airpods. I have the menu bar menu that lets me change audio source and raise/lower volume. I didn’t see any way for keyboard maestro to go all the way there so i tried the recording tool but this seems to be a solution that works some times. not very solid. Is there another way I can accomplish this?
to make matters more complicated, im doing this on a mac book pro 13 which i plug and unplug from an external monitor that becomes the display(they are mirrored). does that mean that the movements i make with keyboard maestro will break once i unplug the macbook pro from the monitor?

1 Like

Rather than Keyboard Maestro, this seems like a job for the ToothFairy app.


I second this. I use it and it works flawlessly.

Looks like a great solution for this specific problem but just to learn in general do you guys ever use keyboard maestro to access any of those menu items in the upper right corner?

Tooth fairy here as well.

Also, I have a keyboard shortcut in TF that I sometimes trigger in a larger KM script!

I occasionally use Keyboard Maestro to trigger menu bar items in cases where the app doesn’t support keyboard shortcuts.

For example, here’s a macro that opens the Users menu by looking for it’s menu bar icon. It’s not a great solution (and will need to be updated for macOS Mojave to support both dark and light mode), but it does the job.


p.s. Another vote for ToothFairy…and it supports global keyboard shortcuts.

1 Like

I tried this Alfred workflow, but it did not work well all the time.

Toothfairy is flawless so far.

Agree. Brilliant solution worth every cent.

Wow awesome little app, Thanks for sharing,

I’m confused as to why ToothFairy is so popular. Doesn’t clicking on the Volume button in the menu bar and then changing the output device accomplish the same thing, albeit with one extra click?

Only if the AirPods are already paired with the computer.

1 Like

But after the initial pairing don’t they pair automatically? I paired them the first time and since then all I have to do is click on the Volume button as previously mentioned and they work.

I don’t mean to be difficult, just trying to understand the benefit!

Not if you’re using them with other devices.


I don’t connect my AirPods to my computer, but would really like to see an easy way to switch their connection between the iPad and the iPhone. Anybody have any neat trick for doing that without digging into system preferences in iOS?

You know when airpods first came out and before I think their first firmware update I thought that they did automatically connect to the device you were using, no settings stuff needed. apparently I was dillusional, but I swear it was originally much easier. I’m not sure of any faster way then swiping the control center, and 3d touching or long using the currently playing section, then touching on the airplay symbol and hitting your airpods. Granted, it still is easier than other Bluetooth headphones.

I know this is an old post, but I just tested this. Connected AirPods to iPhone, go to MB Air, click volume icon, select AirPods. Bing! Connected and working.

@Ajay is right - not quite as fast as a hotkey shortcut, but close enough! Sometimes simpler is better…

I can highly recommend the small command-line tool https://github.com/lapfelix/BluetoothConnector

All you need to do is get the MAC address of your connected AirPods Pro by holding down ⌥ when clicking the Bluetooth icon in the menubar.

If you run the command /usr/local/bin/bluetoothconnector -c a0-b1-c2-d3-e4-f5 -n (replace the MAC address with yours) the AirPods will be connected immediately. Hijacking their connection from another iOS device also works flawlessly.

If you run /usr/local/bin/bluetoothconnector -d a0-b1-c2-d3-e4-f5 -n the will be disconnected.

I’ve wrapped it in a quick Alfred workflow, but using Keyboard Maestro’s “execute shell script” action will also work :ok_hand:

I use a KM macro to get my AirPlay speakers selected, but I don’t see why it wouldn’t work with AirPods. First, I set the system volume to zero (so that the next step works). Then, I use KM’s “found image” action to find the volume menu bar (I found that if the volume were non-zero, the change in the image could cause the macro to fail, hence the volume to zero). Then, click “down” on the menu. You’ll need to adjust the distance, I assume, for your own screen. This works on a 13" MBP. I have two offices where I use this (home and church), and even though the sound options change between the two, this still works in both.

I hope this helps. I’m attaching a screen shot below, I think.


I take no credit for this script and apologize to whoever the creator was, but this works every time.

activate application “SystemUIServer”
tell application “System Events”
tell process “SystemUIServer”
– Working CONNECT Script. Goes through the following:
– Clicks on Bluetooth Menu (OSX Top Menu Bar)
– => Clicks on SX-991 Item
– => Clicks on Connect Item
set btMenu to (menu bar item 1 of menu bar 1 whose description contains “bluetooth”)
tell btMenu
tell (menu item “INSERTYOURAIRPODSNAMEHERE” of menu 1)
if exists menu item “Connect” of menu 1 then
click menu item “Connect” of menu 1
return “Connecting…”
click btMenu – Close main BT drop down if Connect wasn’t present
return “Connect menu was not found, are you already connected?”
end if
end tell
end tell
end tell
end tell

1 Like

Thanks for this! It works great, though for some reason, the else statement doesn’t close my menu when I’m connected. Not sure what the issue is. Not a big deal as I probably won’t try to connect when I’m already connected, and I can just press Esc.