Program to Switch Audio Output

I just discovered this command-line gem for switching audio output. Unpack the attached .zip file and put the executable wherever you like to have them. The .zip file also has the Xcode project to generate the executable, in case you are interested in looking at the source. (Warning: it is pretty deep.)

Once you have the executable in place just type AudioSwitcher in the terminal to get a list of options. Then use Execute Shell Script actions to invoke this from KM macros. (Remember to put in the full path.)

I have been switching audio output for a long time using a particularly unreliable GUI script. I am thrilled to have this command-line tool.

AudioSwitcher.zip (107.1 KB)

2 Likes

very useful! I was’t aware that this thing existed :slight_smile: Thanks!

Me either, and I’ve been looking for years.

Any chance to tell me how to install this tool please? I haven't got a clue. Thank you!

  1. Copy and paste this command into Terminal to install Homebrew, as per the instructions on the Homebrew website:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  1. Copy and paste this command into Terminal once Homebrew is installed, as per the instructions on the switchaudio-osx GitHub page.

brew install switchaudio-osx

And that's all there is to it.

I know it may seem obvious to most, but I really didn't know, thank you kindly for that, I managed and it works, thank you!

1 Like

When I use the command in Terminal, works without a problem, but when I use it in Keyboard Maestro, with the Action "Execute Shell Script" it gives me error "Command not found". Been reading for the last 2 hours all the tutorials and manuals and can't figure out what I am doing wrong.

29

This can be resolved by creating/editing KM's ENV_PATH variable, as per these instructions, or by including the full path to switchaudio-OSX in the "Execute Shell Script" action, which is what I've done myself in this case:

image

You Sir are a :star:! If you ever happen to be in Dublin, Ireland, I'm buying you a few :beer:! Thank you very much, appreciated!

1 Like