I got my AirPods, overall very pleased with them. However, when I move from my phone to my computer, I need to (1) connect to the Bluetooth and then (2) select the AirPods as a device.

I wrote a macro to do this (attached). However, I did not include the last part of actually selecting the AirPods from the Sound Output list (I do bring the list up). The selection process I was trying to do by using the “click on an image” function. But it has proven unreliable.

I am wondering if there is a better way to select the Bluetooth device of interest in a more systematic way.

There seems to be a commandline utility you can install, which lets you change the audio output from the shell:

This isn’t exactly what you want (and it is a 99¢ purchase), but it may serve your needs. It is a tiny utility that sits in the menu bar, and can be activated with one click or a global hotkey:

Assuming you are talking of the Bluetooth menu bar menu, this thread will certainly be useful:

Also some posts here and/or this one.

It seems you forgot to attach the macro.

Yeah, I messed that up. Thanks for the headsup for the attachement as well as the comments. Connect Airpods Through Computer.kmmacros (25.8 KB)

OK, well I downloaded the 99 cent app, and it does connect the AirPods to the Bluetooth… but I got that far with KM as well.

The issue is that once the AirPods are connected, you then have to go into the sound/sound output menu and choose the AirPods (rather than, say, the headphone port) - this is the part that I am trying to fix. And it seems that using methods like “click on the image” to select the AirPods as the audio device does not provide consistent results.

Any insights appreciated.


Have a closer look at the links I gave you, especially the first one. It is (mainly) about getting to a menu item via AppleScript UI scripting. (Not via image clicking.)

The macro you have attached is 100% based on KM mouse clicking and simulating keystrokes. This should be the last remedy if nothing else works, but, as you have noticed, it is not the most reliable thing.

Try to build a macro using the information and hints from the links. Depending on the menu this can be more or less tricky, but, if you get stuck at any point post the macro here, and I’m sure you will receive helpful hints.

This sounds odd to me. Do you have any sound utilities installed? Like Boom or Soundflower? Do you leave Bluetooth on all of the time? (I do.)

I have some Bose bluetooth headphones, and when I turn them on, my Mac connects to them and they are automatically the chosen input and output. I’m not sure why the AirPods wouldn’t do the same.

And if I turn off the Bose headset, my MacBook automatically changes back to its internal input and output.

Maybe try un pairing and repairing the AirPods?

I had a number of those extensions installed (specifically Boom and Soundflower) and went through and deleted them. I use Soundflower but will wait until the next time I need it to figure out a proper configuration.

Anyway, that appeared to tame the issues about the device selection. Now when I connect the AirPods, they are selected as the sound device.

I did look at the links for the AppleScript. However, there appears to be some configuration effort with regard to compilation, etc., so did not get into it too much as the cleaning up of sound device drivers seemed to fix things. If the issue resurfaces, I’ll go further down that path.

Many thanks to all for the support!

You’re welcome—glad we were able to help in some small way!

This is what I have come up with. I took screenshots of the AirPods image in 3 different states: selected and blue highlighted, selected and gray highlighted (because it is in the background), and unselected, so it will find the image regardless of the selected state.
Feel free to modify for your specific needs.

Toggle Airpods Connection.kmmacros (27.6 KB)

Hi Guys, Just an update on my plight to switch between devices.

FYI that ToothFairy has proven helpful in this regard. I actually purchased BeatsX and AirPods that I move between my iPhone, Macbook Pro, and Apple TV 4th Gen. The AirPods on the 4th Gen Apple TV are cool because the Apple TV controller can control the volume (a convenience).