A tiny headless macOS daemon that keeps your microphone on the right device, automatically, so you stop fiddling with Sound settings.
- Prefer a wired external mic (USB, Thunderbolt, …).
- Otherwise the built-in mic — unless the laptop lid is closed (a muffled clamshell mic is worse than a headset), in which case it's demoted.
- Bluetooth only as a last resort — never chosen while anything else is available.
- A manual pick wins. If you select an input yourself, ezmic pins that device and stops touching the setting until it disconnects.
It's event-driven via CoreAudio — no UI scripting, no polling for devices — and needs no Microphone and no Accessibility permission: it sets the default device, it never records. The whole thing is ~350 lines of Swift you can read.
brew install nikitakatchik/tap/ezmic
brew services start ezmicThat's it — it now runs in the background and starts at login. No Gatekeeper prompt (Homebrew builds it locally), no scary permissions.
Update / uninstall:
brew upgrade ezmic
brew services stop ezmic && brew uninstall ezmicgit clone https://github.com/nikitakatchik/ezmic
cd ezmic
swiftc -O -o ezmic ezmic.swift
./ezmic --status # try it; --once to apply once(For an always-on background service, Homebrew is the easy path; otherwise wrap the binary in your own launchd agent.)
ezmic --status # devices, lid, and what it'd pick (read-only)
ezmic --once # evaluate and apply once, then exit
ezmic --reset # forget the manual-override pinLogs (Homebrew service): $(brew --prefix)/var/log/ezmic.log.
The daemon remembers which device it last set. When the default input changes and (a) it wasn't the daemon and (b) no device was just added/removed, that's a genuine human choice — so it gets pinned. A hotplug that makes macOS auto-switch is not treated as a manual pick; the rules win there.
- Building requires the Swift toolchain (Xcode Command Line Tools:
xcode-select --install). - Aggregate / virtual / Continuity (iPhone) inputs are never auto-selected, but are honoured if you pick one manually.