Between a nearby HomePod, my Mac mini speakers, and an attached USB mic with a headphone input, I frequently change my sound output on my Mac.

Changing the output is simple enough, but it’s annoying to open System Preferences, click the Output tab, and choose a new output.

Output sound settings panel

The Tools

Keyboard Maestro is great at this kind of stuff. 1 The app lets you automate nearly anything on your Mac. Control applications, manipulate text and images, run scripts—you name it! As of this post the app is only $36, though I’d gladly pay much more for it. There’s even a generous free trial!

Get Keyboard Maestro

Note: It’s not difficult to do some fairly basic things in Keyboard Maestro. You don’t need to know how to code or anything like that. If you get stuck there’s a fairly extensive WIKI page and a great forum community for more specific questions. The easiest way to learn it, however, is probably with David Spark’s field guide.

The Setup

It’s a simple macro, but it’s great to quickly switch to my over-ear headphones when I get a FaceTime audio call or to quickly Airplay to my HomePod mini.

keyboard maestro interface

If you already have Keyboard Maestro you can get the macro here:

Download Macro

I’ll link to this macro below, but here’s a few things to note:

Pauses

I add pauses because…well, it’s generally just good practice. Sometimes scripts don’t work well without them, so I nearly always add minuscule pauses to ensure scripts run smoothly.

Customization

To change the macro, open your System Preferences to the panel shown above and click Get in the Move and Click action. A countdown will begin. Click on the System Preferences pane to make it active and over your cursor over the sound output you’d like to use. When the countdown stops, Keyboard Maestro will grab the location of your mouse. That’s it. Next time you run it, it’ll select your new output.

Conflict Palette

I give similar macros the same hot key.2 When you press it, Keyboard Maestro displays a conflict palette.

km conflict pallete

To further narrow your palette options, type a letter until only one macro remains at which point that macro is triggered. In this case, I press shift + control + option + cmd3. This presents the conflict palette. Pressing m triggers “Mac audio” automatically since it’s the only macro that starts with an M.

What about AirPods?

While you can set up AirPods or other bluetooth speakers to your output using this macro, I’ve used a different single-use app for that. It’s called Toothfairy and its sole purpose is to one-click/keypress connect or disconnect bluetooth devices to your Mac.

Get Toothfairy App

  1. I tried doing this with AppleScript, but 1) it was slower than using Keyboard Maestro and 2) I couldn’t get it to work for my HomePod. If you don’t want to buy Keyboard Maestro, just google “AppleScript change sound output” and you’ll find several scripts for standard sound outputs you can run for free through Automator. ↩︎

  2. Adding a Hyper Key with Karabiner Elements per Brett Terpstra’s instructions opens dozens more keyboard shortcuts. ↩︎

  3. Again, with the hyper key…I’m not an animal. ↩︎