Change macOS audio input/output source from the command line
Change macOS audio source from the command-line
SwitchAudioSource
$ SwitchAudioSource -a
$ SwitchAudioSource -s "External Speakers"
$ SwitchAudioSource -t input -s "Built-in Microphone"