---
title: "AudioKick, One Click To Fix Crackling Mac Audio"
url: https://deallocatedobjects.com/posts/audiokick-one-click-to-fix-crackling-mac-audio
author: Jake Marsh
published: 2026-10-21
updated: 2026-10-21
topics: ["Things I Made", "Apple"]
description: "Every few days the music on my Mac starts crackling. Pops, little dropouts, sometimes a robotic buzz over everything. The fix has always been the same: open Terminal, type sudo killall coreaudiod, type my password, and wait a second for sound to come back."
---

# AudioKick, One Click To Fix Crackling Mac Audio

By Jake Marsh, October 21, 2026. HTML: https://deallocatedobjects.com/posts/audiokick-one-click-to-fix-crackling-mac-audio

Every few days the music on my Mac starts crackling. Pops, little dropouts, sometimes a robotic buzz over everything. The fix has always been the same: open Terminal, type `sudo killall coreaudiod`, type my password, and wait a second for sound to come back. Then go back to Music and press pause and play, because it usually still thinks it's playing while nothing comes out.

I've typed that command more times than I'd like to count, so I made it a menu bar button. AudioKick restarts Core Audio in one click (or with Control-Option-Command-R from anywhere), waits for it to come back, and resumes Music and Spotify if they were playing. It's free, and you can grab it at [greatwork.company/apps/audiokick](https://greatwork.company/apps/audiokick/).

![The AudioKick menu: Restart Core Audio at the top, then the current output (MacBook Pro Speakers, 48 kHz) and input (MacBook Pro Microphone, 48 kHz), then toggles for resuming Music and Spotify, keeping the Mac's microphone as input, restarting after waking from sleep, the global shortcut and opening at login.](https://deallocatedobjects.com/media/posts/audiokick-one-click-to-fix-crackling-mac-audio/menu.png "The whole app is this menu.")

### Restarting coreaudiod Without Terminal

`coreaudiod` is the system daemon that sits between every app and your audio hardware. It runs as root, so killing it needs root too. launchd starts it again on demand the next time anything asks for audio, which is why the Terminal trick works.

AudioKick has two ways to get there. The first time, it uses the standard macOS administrator prompt, the same dialog you see when an installer asks for your password. Under the hood that's AppleScript's `do shell script ... with administrator privileges`, run with a command built only from constants:

```swift title="CoreAudioRestarter.swift"
let source = "do shell script \"\(escaped)\" with administrator privileges"
var error: NSDictionary?
NSAppleScript(source: source)?.executeAndReturnError(&error)
if let error {
    if (error[NSAppleScript.errorNumber] as? Int) == -128 { throw Failure.cancelled }
    throw Failure.failed(error[NSAppleScript.errorMessage] as? String ?? "The admin command failed.")
}
```

Error -128 is the user pressing Cancel, so that path quietly puts the menu bar icon back instead of showing an error.

After that first restart, AudioKick offers to skip the password next time. If you say yes, it writes a sudoers rule that allows your account to run exactly one command, with exactly those arguments, and nothing else:

```text title="/etc/sudoers.d/audiokick"
yourname ALL=(root) NOPASSWD: /usr/bin/killall coreaudiod
```

It writes the rule to a temporary file, checks it with `visudo -cf`, and only then installs it with `install -o root -g wheel -m 0440`, all inside one admin prompt. A sudoers file with a syntax error can lock you out of `sudo` entirely, so validating before installing is the part I care about most. The user name gets checked against a simple pattern before it goes anywhere near that file, too.

From then on every restart tries `sudo -n /usr/bin/killall coreaudiod` first. The `-n` means "never prompt", so if the rule is there it just works, and if it isn't, `sudo` fails right away and AudioKick falls back to the password dialog. There's a menu item to remove the rule whenever you want.

### Waiting For It To Come Back

Killing the daemon is the easy part. The interesting part is knowing when audio is ready again. Since `coreaudiod` is launch-on-demand, the best way to bring it back is to ask for audio. So AudioKick polls every quarter second for up to ten seconds, asking the Core Audio HAL for the default output device each time. That request is what makes launchd start the daemon. It's done when `pgrep` shows a `coreaudiod` with a new process ID and the default output device answers:

```swift title="CoreAudioRestarter.swift"
for _ in 0..<40 {
    try await Task.sleep(nanoseconds: 250_000_000)
    _ = AudioDevices.defaultDevice(input: false)
    if let pid = coreaudiodPID(), pid != oldPID, AudioDevices.defaultDevice(input: false) != nil {
        // Give apps a moment to reconnect before anyone touches playback.
        try await Task.sleep(nanoseconds: 700_000_000)
        return usedPassword
    }
}
throw Failure.didNotComeBack
```

That short pause at the end gives other apps a moment to reconnect to the new daemon before AudioKick touches playback. It also re-registers its own device listeners, since those belonged to the old process.

### Picking Your Music Back Up

The silent "still playing" state is the most annoying part of the whole thing. Music and Spotify keep their playhead moving, but their audio output went away with the old daemon. A pause and play makes them open a fresh one.

So before restarting, AudioKick checks which players are running and asks each one for its player state over AppleScript. It only looks at apps that are already open, so it never launches Music on you. After the restart, it sends pause, waits 0.3 seconds, then play, to just the ones that were playing. You hear a tiny gap and your song keeps going.

### Bluetooth Headset Mode

While I was in there I added the other audio fix I do by hand all the time. When a Bluetooth headset becomes your Mac's input device, macOS switches the headphones into headset mode so it can use their microphone. Headset mode uses a much lower quality codec, and music on it sounds crunchy in a way that's easy to mistake for the crackling problem.

AudioKick's menu shows your current input and output with their sample rates, and warns you when the input is a Bluetooth device. There's a "Keep the Mac's Microphone as Input" option that listens for default device changes through `AudioObjectAddPropertyListenerBlock`. When a Bluetooth device takes over as input, it finds the Mac's built-in microphone (a built-in device with input streams) and switches back to it, so your headphones stay in their high quality mode.

### The Rest

There's an option to restart automatically after waking from sleep, which waits a few seconds first so Bluetooth devices can reconnect. The global shortcut uses Carbon's `RegisterEventHotKey`, so there's no Accessibility permission to grant. And there's an "Open Audio MIDI Setup" item for when you want to dig into sample rates yourself.

It's a small app built for one very specific annoyance of mine. If your Mac's audio crackles too, I hope it saves you some typing.
