I would like to change sound output device (like option-clicking the speaker icon in the menubar) via script, but NOT through UI scripting, e.g., launching the System Pref panel.
UPDATE: Using @Mateusz solution below, here is an Applescript that, when launched, will give you a popup to select the desired audio output device:
set devices to do shell script "/Applications/Audiodevice/audiodevice output list"
set answer to choose from list (paragraphs of devices) with title "Audio Output" with prompt "Select a device" without multiple selections allowed
if answer is false then return
do shell script "/Applications/Audiodevice/audiodevice output " & quoted form of item 1 of answer
(Note: you need to put the audiodevice
file in /Applications
)
brew install switchaudio-osx
but it reports:switchaudio-osx: A full installation of Xcode.app is required to compile this software. Installing just the Command Line Tools is not sufficient. Xcode can be installed from the App Store. Error: An unsatisfied requirement failed this build.
Any way around this?
– d0g Oct 28 '15 at 10:42switchaudio-osx
relies on dependencies etc. defined in Xcode (the application). Somebody who knows his way around Xcode better than I do could probably extract them into a Makefile. – nohillside Oct 28 '15 at 13:53mas
, thenxcode
, thenswitchaudio-osx
. This way you benefit from updated source-code and not a pre-compiled binary that potentially is unsafe or falls out of date. See: install-switchaudio.sh – Niko Jan 30 '18 at 17:30brew install switchaudio-osx
! – d0g Jan 30 '18 at 23:10