fix-my-mic 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yigit Konur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # 🙅🏻‍♂️ no airpods mic
2
+
3
+ > every time i connect my AirPods, macOS silently switches my mic input to them. my voice goes from studio-quality 48kHz to walkie-talkie 16kHz mono. i got tired of manually switching it back. so i made this.
4
+
5
+ one command. installs itself. runs forever. no app, no menu bar icon, no GUI. just your MacBook's built-in mic, always.
6
+
7
+ ## install
8
+
9
+ ```bash
10
+ npx fix-my-mic
11
+ ```
12
+
13
+ that's it. picks a mode, compiles from source on your machine (no code signing, no quarantine, no gatekeeper drama), and starts a background daemon. no sudo needed.
14
+
15
+ **want to change settings or uninstall? run the same command again.**
16
+
17
+ don't have node? use curl:
18
+
19
+ ```bash
20
+ curl -fsSL https://yigitkonur.com/disable-airpods-mic.sh | bash
21
+ ```
22
+
23
+ or clone it:
24
+
25
+ ```bash
26
+ git clone https://github.com/yigitkonur/cli-disablemic.git && cd cli-disablemic && ./install.sh
27
+ ```
28
+
29
+ ### requirements
30
+
31
+ - macOS 12 (Monterey) or later
32
+ - Xcode Command Line Tools (the installer will prompt you if missing)
33
+
34
+ ## how it works
35
+
36
+ it's a ~600-line Swift daemon that talks directly to CoreAudio. no dependencies, no third-party libraries, no electron, no python, no node. just Apple frameworks.
37
+
38
+ 1. **event-driven, not polling.** registers CoreAudio listeners on the default input device and the device list. the instant something changes, it gets a callback. between events, it's fully idle at 0.0% CPU.
39
+
40
+ 2. **finds the built-in mic by transport type**, not by name. works on MacBook Pro, MacBook Air, iMac, Mac Mini, Mac Studio — any Mac with a built-in microphone.
41
+
42
+ 3. **blocks Bluetooth input** (classic and LE) and unknown wireless transports like iPhone Continuity mic. USB mics and aggregate devices are left alone.
43
+
44
+ 4. **defeats AirPods HFP flip-backs.** AirPods sometimes re-negotiate the input 1-3 seconds after connecting. mic-guard re-asserts the built-in mic every 0.5s for 5 seconds after a change, then goes fully idle again.
45
+
46
+ 5. **uses Apple Unified Logging** (`os_log`), not log files. the system handles rotation automatically.
47
+
48
+ ## two modes
49
+
50
+ the installer asks you to pick:
51
+
52
+ ### 1) always block (default)
53
+
54
+ your built-in mic is always the default. AirPods and Bluetooth mics are never used as input. install and forget.
55
+
56
+ ### 2) respect manual override
57
+
58
+ same as above, but if you switch back to AirPods within 10 seconds of mic-guard reverting it, mic-guard goes "ok, you clearly want this" and pauses itself for 1 hour. after the hour, it resumes automatically.
59
+
60
+ perfect for when you actually need your AirPods mic for a call.
61
+
62
+ ## resource usage
63
+
64
+ | metric | value |
65
+ |--------|-------|
66
+ | CPU (idle) | 0.0% |
67
+ | CPU (during 5s stabilization) | ~0.0% (a few microsecond ticks) |
68
+ | memory | ~12 MB RSS |
69
+ | disk | ~65 KB binary |
70
+ | network | none |
71
+
72
+ ## commands
73
+
74
+ ```bash
75
+ # need your AirPods mic for a sec?
76
+ mic-guard pause # pause indefinitely
77
+ mic-guard pause 30 # pause for 30 min, auto-resumes
78
+ mic-guard resume # back to blocking
79
+ mic-guard status # what's going on?
80
+
81
+ # nerdy stuff
82
+ log stream --predicate 'subsystem == "com.local.mic-guard"' --style compact
83
+ launchctl kickstart -k gui/$(id -u)/com.local.mic-guard # restart
84
+ launchctl bootout gui/$(id -u)/com.local.mic-guard # stop until next login
85
+ ```
86
+
87
+ ## uninstall
88
+
89
+ run the install command again and pick "uninstall":
90
+
91
+ ```bash
92
+ npx fix-my-mic
93
+ ```
94
+
95
+ or nuke it manually:
96
+
97
+ ```bash
98
+ launchctl bootout gui/$(id -u)/com.local.mic-guard
99
+ rm ~/.local/bin/mic-guard
100
+ rm ~/Library/LaunchAgents/com.local.mic-guard.plist
101
+ rm -rf ~/.config/mic-guard
102
+ ```
103
+
104
+ ## why not just use an app?
105
+
106
+ there are GUI apps that do this — [SoundAnchor](https://apps.kopiro.me/soundanchor/), [AirPods Sound Quality Fixer](https://github.com/milgra/airpodssoundqualityfixer), [audio-device-blocker](https://github.com/jbgosselin/audio-device-blocker). they work, but:
107
+
108
+ - need code signing/notarization or `xattr -cr` to bypass Gatekeeper
109
+ - run a menu bar icon you don't need
110
+ - may not survive macOS updates
111
+ - require manual download and drag-to-Applications
112
+
113
+ this compiles from source on your machine (born trusted, no signing needed), runs as a headless `launchd` agent (no GUI), and is a single Swift file you can read in 5 minutes.
114
+
115
+ ## the nerdy details
116
+
117
+ single file: `main.swift`. only uses Apple frameworks (`CoreAudio`, `Foundation`, `os.log`). compiles with `swiftc` — no Xcode project, no Package.swift, no CocoaPods, no SPM.
118
+
119
+ key CoreAudio APIs:
120
+ - `AudioObjectAddPropertyListener` — event callbacks
121
+ - `AudioObjectGetPropertyData` / `SetPropertyData` — read/write device properties
122
+ - `kAudioHardwarePropertyDefaultInputDevice` — the system default input
123
+ - `kAudioDevicePropertyTransportType` — distinguish built-in from Bluetooth
124
+
125
+ ## license
126
+
127
+ MIT — do whatever you want with it.
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("child_process");
3
+
4
+ if (process.platform !== "darwin") {
5
+ console.error("fix-my-mic only works on macOS.");
6
+ process.exit(1);
7
+ }
8
+
9
+ const r = spawnSync(
10
+ "bash",
11
+ [
12
+ "-c",
13
+ 'eval "$(curl -fsSL https://raw.githubusercontent.com/yigitkonur/cli-disablemic/main/install.sh)"',
14
+ ],
15
+ { stdio: "inherit" }
16
+ );
17
+
18
+ process.exit(r.status || 0);
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "fix-my-mic",
3
+ "version": "1.0.0",
4
+ "description": "stop macOS from using your AirPods as the default microphone. one command, runs forever.",
5
+ "bin": {
6
+ "fix-my-mic": "bin/fix-my-mic.js"
7
+ },
8
+ "files": [
9
+ "bin/"
10
+ ],
11
+ "os": [
12
+ "darwin"
13
+ ],
14
+ "keywords": [
15
+ "airpods",
16
+ "microphone",
17
+ "macos",
18
+ "audio",
19
+ "bluetooth",
20
+ "hfp",
21
+ "coreaudio",
22
+ "built-in-mic"
23
+ ],
24
+ "author": "Yigit Konur (https://yigitkonur.com)",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/yigitkonur/cli-disablemic"
29
+ },
30
+ "homepage": "https://github.com/yigitkonur/cli-disablemic#readme"
31
+ }