Audio Priority is a macOS CLI daemon that automatically manages audio device priorities. Configure preferred input/output order and let the daemon keep your defaults in sync as devices connect and disconnect.
Website: https://badalotti.dev/audio-priority
- Priority-based auto-switching: Always picks the highest-priority connected device.
- Manual mode: Disable auto-switching when you want to manage defaults yourself.
- Device memory: Remembers devices you've connected (even when disconnected).
- Boot on login: LaunchAgent starts the daemon automatically.
- macOS 14.0 (Sonoma) or later
brew install mateusbadalotti/audio-priority-cli/audio-priority-cli./build.shThe CLI binary will be at dist/audio-priority.
The build also outputs dist/Frameworks/AudioPriorityCore.framework, which must stay alongside the binary.
xcodebuild -scheme AudioPriorityTests testNote: running tests requires macOS 14 or later.
# Install LaunchAgent using the current binary
./dist/audio-priority install
# Or copy the binary to a directory and install using that path
./dist/audio-priority install --path ~/.local/binBy default, the install command copies the binary to ~/.local/bin, writes a LaunchAgent to ~/Library/LaunchAgents/com.audio-priority.daemon.plist, and starts it.
If you use --path, the installer copies the binary to that location instead. In both cases, it also copies Frameworks/AudioPriorityCore.framework alongside the binary.
# List output devices (indexes shown in order)
audio-priority list --output
# Set output priority by index (1 = highest priority)
audio-priority set output 2 1 3audio-priority [--output] [--input] [--json] # show priorities (default)
audio-priority list [--output] [--input] [--known] [--json]
audio-priority set <input|output> <indexes...>
audio-priority set <input|output> --uids <uids...>
audio-priority mode <auto|manual>
audio-priority apply
audio-priority forget-disconnected [--output] [--input]
audio-priority status [--json]
audio-priority --versionaudio-priority install [--path <dir|path>] [--bin <path>] [--no-start]
audio-priority uninstall [--keep-binary]
audio-priority start
audio-priority stop- Device Discovery: Uses CoreAudio to enumerate devices and listen for changes.
- Priority Storage: Priorities are stored in
UserDefaultsby device UID. - Auto-Switching: When a device appears, the daemon selects the highest-priority connected device (unless manual mode is enabled).
- Uses CoreAudio device APIs to list input/output devices and to set system defaults.
- Monitors CoreAudio property changes to react to device connects/disconnects and default changes.
- Requires macOS (CoreAudio is part of the system frameworks).
AudioPriority/
├── main.swift # CLI entrypoint
├── AudioPriorityCLI.swift # Command parsing
├── AudioPriorityController.swift # Core logic
├── Models/
│ └── AudioDevice.swift
├── Services/
│ ├── AudioDeviceService.swift
│ └── PriorityManager.swift
└── LaunchAgentManager.swift
AudioPriority: CLI tool.AudioPriorityCore: shared framework target for core logic.AudioPriorityTests: unit tests (links againstAudioPriorityCore).
MIT License - see LICENSE for details.
See CHANGELOG.md.