Created
January 21, 2026 22:20
-
-
Save redaphid/62967e709e4bfb6bef5803d8bcd72577 to your computer and use it in GitHub Desktop.
Toggle macOS audio between headphones and built-in speakers/mic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Toggle between MOMENTUM 4 and MacBook Pro built-in audio | |
| command -v SwitchAudioSource &>/dev/null || { echo "Error: run 'brew install switchaudio-osx' first" >&2; exit 1; } | |
| if [[ "$(SwitchAudioSource -c)" == "MOMENTUM 4" ]]; then | |
| SwitchAudioSource -s "MacBook Pro Speakers" | |
| SwitchAudioSource -t input -s "MacBook Pro Microphone" | |
| else | |
| SwitchAudioSource -s "MOMENTUM 4" | |
| SwitchAudioSource -t input -s "MOMENTUM 4" | |
| fi | |
| osascript -e "display notification \"$(SwitchAudioSource -c)\" with title \"Audio\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment