A tiny native macOS menu-bar app that keeps your chosen audio input and output devices exactly where you put them.
Project page: neuroccm.github.io/AudioIOKeeper (source in docs/index.html).
macOS loves to switch audio devices on its own: take out an AirPod, walk near your iPhone, plug in a display — and your mic or speakers silently change mid-call. Audio IO Keeper pins the devices you choose in the app and, whenever macOS moves a default on its own, moves it straight back.
- Each device in the menu-bar popover has a pin beside it. Click a device or its pin to lock it in: the pin turns blue, that device is used right away, and it stays locked. Click the blue pin again (or right-click the device) to unpin/unlock it. You can also select or unpin locked devices directly in Settings → Locked devices (including locking macOS system alert sounds to your pinned output). Duplicate device names (such as dual displays or HDMI + DisplayPort audio on the same monitor) are automatically labeled with their connection type.
- The app listens for Core Audio default-device changes. If a default drifts away from your pin (AirPods removed, Continuity iPhone mic appearing, a new display grabbing audio…), it is restored right away.
- If your pinned device disconnects, nothing is forced and nothing breaks: macOS uses its own fallback, the app shows a warning state, and your pin is restored the moment the device comes back.
- If something else keeps switching a default back (another utility, an automation), the keeper does not fight it switch-for-switch: after a few immediate restores it backs off with growing cooldowns (2 s up to 60 s), retries periodically, and shows a conflict state in the popover. During such a conflict restoration is deliberately not instant — that qualifies the "restored right away" behavior above, which applies to ordinary one-off switches.
- Moving between docks or hubs? The Rescan button (popover header, and in Settings) re-reads the connected devices and re-checks your pins, for the rare cases where a hot-plug change was missed.
- To stop locking a direction, click its blue pin again. The device in use does not change; macOS may switch freely from then on.
- Need macOS to switch just this once — AirPods in for a single call? Settings → Temporarily unlock pins for 15 minutes leaves your pins chosen but not enforced for 15 minutes, then locks and restores them automatically. The deadline survives a relaunch, and the popover shows a "Lock pins now" button while it runs.
- Every action the keeper takes is shown in the popover's activity log. An app that overrides system behavior should never act invisibly.
Audio IO Keeper only reads and writes the standard system-default input/output device — the exact same Core Audio properties that System Settings → Sound uses. It installs no drivers, kernel/system extensions, or audio plug-ins, uses no private APIs, never records or plays audio, has no network code, and runs in the App Sandbox with the Hardened Runtime. Quitting the app leaves your system exactly as it was; there is nothing to uninstall beyond the app itself.
- macOS 14 (Sonoma) or later
- Download
AudioIOKeeper-<version>.dmgfrom Releases (or build the DMG yourself, below). - Open the DMG and drag AudioIOKeeper onto the Applications shortcut next to it. Then eject the disk image.
- Launch Audio IO Keeper from your Applications folder. It lives in the menu bar (waveform icon) — there is no Dock icon or main window.
- First launch only: release builds are ad-hoc signed and not notarized by Apple (no paid Developer ID yet), so macOS may refuse to open it. Right-click (Control-click) the app in Applications → Open → Open. If your macOS version does not offer that, open System Settings → Privacy & Security and click Open Anyway after the first blocked attempt. You only do this once.
Optionally enable Launch at login in Settings so it is always on guard. To uninstall, quit the app from its menu and delete it from Applications.
First launch: the app adopts whatever input/output macOS is already using as the initial pins, so "keep what I have" works immediately — change them any time from the popover.
Requirements: a Mac with Xcode 16+ (full Xcode, not just the Command
Line Tools). If xcodebuild -version complains about the active developer
directory, select Xcode once with
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.
XcodeGen (brew install xcodegen)
is only needed if you edit project.yml; the generated .xcodeproj is
committed and CI keeps it in sync.
Build and run in Xcode:
git clone https://github.com/neuroccm/AudioIOKeeper.git
cd AudioIOKeeper
open AudioIOKeeper.xcodeproj # then Run (Cmd-R)Run the tests:
xcodebuild test -scheme AudioIOKeeper -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NOOne command builds the app in Release (universal: Apple silicon + Intel) and packages it into a disk image containing the app, an Applications shortcut, a short README, and the license:
scripts/make-dmg.sh # writes ./AudioIOKeeper-<version>.dmgThen install exactly like a downloaded release: open the DMG, drag AudioIOKeeper onto Applications, eject, and launch it from Applications (see Install, including the first-launch note).
The build is ad-hoc signed and not notarized. That is fine for your own Mac and for sharing with people who accept the one-time right-click → Open step; a notarized public build would require a paid Apple Developer ID, which the project does not have yet.
| File | Role |
|---|---|
AudioIOKeeperApp.swift |
App entry point, menu-bar scene, launch-time keeper start |
AppModel.swift |
Single source of truth (@Observable, @MainActor) — state, enforcement, activity log |
KeeperEngine.swift |
Pure, hardware-free decision logic: restore-or-not, plus the anti-thrash RestoreThrottle |
AudioDevice.swift |
Value types (AudioDevice, AudioDirection, TransportType, ActivityEntry), hardware protocol, duplicate-name disambiguation |
AudioHardwareWorker.swift |
Serializes all HAL calls on a dedicated queue off the main thread; coalesced change pings; sequenced snapshots so stale reads can't overwrite newer writes |
AudioHardwareClient.swift |
The one place that talks to Core Audio (behind a protocol for testing) |
SettingsStore.swift |
Typed UserDefaults access; pins stored as persistent device UIDs |
MenuContentView.swift / SettingsView.swift |
SwiftUI popover and Settings window |
LoginItemManager.swift |
Launch-at-login via SMAppService |
Design notes:
- Devices are identified by their persistent Core Audio UID, never by the
volatile
AudioDeviceID, so pins survive reboots and reconnects. - Enforcement is loop-free by construction: restoring a pin fires a change
notification, but the engine sees "current == pin" and does nothing. A
competing writer is handled by
RestoreThrottle: bounded immediate restores, then exponential cooldowns with a visible conflict state. - No synchronous Core Audio call ever runs on the main thread, so a stalled driver can't freeze the menu or the Quit button.
- Swift 6 with complete strict-concurrency checking.
Issues and pull requests are welcome — see CONTRIBUTING.md. Every pull request is automatically reviewed by CodeRabbit and must pass CI (build, unit tests, SwiftLint).