Control Bluetooth devices, audio output routing, and volume on macOS through
the macos-audio CLI.
brew install switchaudio-osx # required for output switching
brew install blueutil # required for Bluetooth control
brew install vossenwout/tap/macos-audio-cli
macos-audio scan # clean sections: Bluetooth, Local, AirPlay
macos-audio connect bt <name|mac>
macos-audio connect airplay
macos-audio connect local <name>
macos-audio disconnect <target> # disconnect bluetooth and switch to local output
macos-audio volume set <0-100> # set system output volume
macos-audio volume get # print output volume, input volume, mute state
macos-audio play <file> # play a local audio file
macos-audio play <file> --background # start playback and return immediately
macos-audio status # show output, volume, mute state
macos-audio status --json # same but machine-readable JSON
macos-audio status --device <name|mac> # include bluetooth status for a specific device
| Code | Meaning |
|---|---|
| ------ | --------- |
| 0 | Success |
| 1 | Runtime error |
| 2 | Bad arguments |
| 3 | Target resolution error |
| 4 | Missing tool dependency (blueutil or SwitchAudioSource not installed) |
macos-audio status first to understand the current state before making changes.connect airplay uses the generic AirPlay route; room names in scan are informational.connect airplay is known to be buggy and airplay functionality is still experimental共 1 个版本