I'd like to be able to change my audio inputs / outputs from the command line so that I can script my studio setup.

Is it possible to change the selected audio input / output in MacOS from the command line?

Previously, someone on StackExchange posted a clever AppleScript to do this. However, I'm specifically looking for a way to do this with a terminal command.

1 Answer 1


I did this a while back using a utility. You muse use HomeBrew to install switchaudio-osx.

Someone create a webpage giving instructions how to install and use switch audio-ox. I don't want to take credit for their work. Here is the web page:

Here is a summary and usage of the app:

To Install:

brew install switchaudio-osx


SwitchAudioSource -s "name of audio device"

example: SwitchAudioSource -s "MacBook Pro Speakers"

Here is a list of command switches:

SwitchAudioSource [-a] [-c] [-f format] [-t type] [-n] -s device_name | -i device_id | -u device_uid

-a : shows all devices  
-c : shows current device  

-f format : output format (cli/human/json). Defaults to human.  
-t type : device type (input/output/system). Defaults to output.  
-n cycles the audio device to the next one  
-i device_id : sets the audio device to the given device by id  
-u device_uid : sets the audio device to the given device by uid or a substring of the uid  
-s device_name : sets the audio device to the given device by name

Source: Switch audio output via command line on MacOS - By Pete Houston


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .