MicGuard

Prevents Bluetooth audio devices from hijacking the default macOS microphone

View the Project on GitHub pszypowicz/MicGuard

CLI Reference

MicGuard doubles as a CLI tool. The mic-guard binary is symlinked to /usr/local/bin on install.

Commands perform direct work — CoreAudio calls for volume/mute, config file writes for set/enable/disable/toggle — and then post a requestStatus distributed notification so the daemon re-reads state and broadcasts statusChanged. The daemon is not required for the commands themselves to take effect, but without it no statusChanged notification will be broadcast to external integrations.

Home · Debugging · Integrations · Notifications · Releasing

Exit codes

Code Meaning
0 Success
1 Error (invalid arguments, device not found, etc.)

Global flags

Flag Description
-q, --quiet Suppress confirmation output

Commands

mic-guard list

List all input devices.

$ mic-guard list
MacBook Pro Microphone
External USB Mic
AirPods Pro

With --output json, each device includes extended fields:

$ mic-guard list --output json
[
  {
    "current" : true,
    "muted" : false,
    "name" : "MacBook Pro Microphone",
    "preferred" : true,
    "volume" : 100
  },
  {
    "current" : false,
    "muted" : false,
    "name" : "AirPods Pro",
    "preferred" : false,
    "volume" : 75
  }
]
Field Type Description
name String Device name
current Boolean true if this is the active input device
preferred Boolean true if this is the configured preferred device
volume Integer Input volume 0–100
muted Boolean Mute state

mic-guard current

Print the current default input device.

$ mic-guard current
External USB Mic

mic-guard set <name>

Set the preferred device and switch to manual mode.

$ mic-guard set "External USB Mic"

mic-guard volume <0-100>

Set the input volume on the current device via CoreAudio and notify the daemon.

$ mic-guard volume 50

mic-guard mute

Toggle mute on the current input device via CoreAudio and notify the daemon. Unmute restores the pre-mute volume.

$ mic-guard mute

mic-guard enable

Enable MicGuard. It will revert the default input device whenever it changes away from your preferred mic.

$ mic-guard enable
enabled

mic-guard disable

Disable MicGuard. The default input device can change freely.

$ mic-guard disable
disabled

mic-guard toggle

Toggle MicGuard on/off. Prints the new state.

$ mic-guard toggle
disabled
$ mic-guard toggle
enabled

mic-guard status

Print whether MicGuard is enabled or disabled. When enabled, the current mode is shown in parentheses.

$ mic-guard status
enabled (auto)
$ mic-guard status   # when disabled
disabled

mic-guard ping

Ask the running MicGuard daemon to re-broadcast its current status via a com.pszypowicz.MicGuard.statusChanged distributed notification. Useful for forcing external integrations (e.g. SketchyBar) to refresh.

$ mic-guard ping

mic-guard version

Print the version. Also accepts --version and -v.

$ mic-guard version
mic-guard <version>

mic-guard help

Show usage information. Also accepts --help and -h.

Subcommand help

Every subcommand accepts --help and -h to print its own usage and description.

$ mic-guard volume --help
Usage: mic-guard volume <0-100>

Set input volume (0-100).