Skip to content

Instantly share code, notes, and snippets.

@artemkoloskov
Created June 18, 2026 08:38
Show Gist options
  • Select an option

  • Save artemkoloskov/453ec338cd5f31eaed29285a6a5c0cf8 to your computer and use it in GitHub Desktop.

Select an option

Save artemkoloskov/453ec338cd5f31eaed29285a6a5c0cf8 to your computer and use it in GitHub Desktop.
Keep macOS from re-enabling AWDL — a LaunchDaemon that holds awdl0 down for stutter-free game/VR streaming (Quest/Virtual Desktop, Moonlight, GeForce Now, Parsec)

Keep macOS from re-enabling AWDL (stutter-free game / VR streaming)

A small root LaunchDaemon that holds the awdl0 interface down for as long as you want — so it keeps working even though macOS automatically turns Apple Wireless Direct Link (AWDL) back on every ~10–15 minutes.

The problem

Your Mac has a single Wi-Fi radio. AWDL — the protocol behind AirDrop, Handoff, Sidecar, Universal Control, iPhone Mirroring, and Apple Watch unlock — periodically hops that radio off your Wi-Fi channel to look for nearby Apple devices. Each hop is a ~50–100 ms stall, roughly once a second. For anything real-time over Wi-Fi (Quest / Virtual Desktop, Moonlight, GeForce Now, Parsec, remote desktop) that shows up as constant micro-stutter.

The usual fix is:

sudo ifconfig awdl0 down

…but it does not hold: macOS re-enables AWDL after a few minutes (sooner if AirDrop or Handoff fire). One-shot kills, and once-at-boot LaunchDaemons, silently regress — which is why "I disabled AWDL but the stutter came back" is so common.

What this does

A LaunchDaemon runs a tiny script every 10 seconds. While a flag file exists it forces awdl0 back down; when the flag is gone it lets AWDL come back up (so AirDrop and Handoff work normally when you are not streaming). You get an on/off switch that actually sticks:

touch /tmp/awdl-down    # suppress AWDL — run before a streaming session
rm /tmp/awdl-down       # restore AWDL (AirDrop/Handoff/etc come back within ~10 s)

The flag lives in /tmp, so it also clears on reboot — AWDL is back to normal after a restart until you switch it on again.

Measured effect (my setup: M-series MacBook → Quest 3, Virtual Desktop)

Ping to the router during an active session, AWDL on vs off:

AWDL on AWDL off
mean latency 13.3 ms 4.6 ms
packets over 50 ms 17 / 150 1 / 150
periodic ~500 ms spikes yes gone

Your numbers will vary with your Wi-Fi environment, but the periodic-spike pattern is the AWDL signature. A quick way to see it: ping -i 0.1 -c 150 <your-router-ip> during a session — regular spikes to 50–100 ms with an otherwise clean link (good signal, no packet loss) means AWDL.

Install (normal admin account)

Save awdl-guard.sh and local.awdl-guard.plist from this gist, then:

sudo mkdir -p /usr/local/bin
sudo install -m 755 -o root -g wheel awdl-guard.sh /usr/local/bin/awdl-guard.sh
sudo install -m 644 -o root -g wheel local.awdl-guard.plist /Library/LaunchDaemons/local.awdl-guard.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/local.awdl-guard.plist

Verify

launchctl print system/local.awdl-guard | grep -E 'state|runs|last exit'

runs should climb over time and last exit code should be 0.

Uninstall

sudo launchctl bootout system /Library/LaunchDaemons/local.awdl-guard.plist
sudo rm /Library/LaunchDaemons/local.awdl-guard.plist /usr/local/bin/awdl-guard.sh
rm -f /tmp/awdl-down

Trade-off

While the flag is set, AWDL is down, so AirDrop, Handoff, Sidecar, Universal Control, iPhone Mirroring, and Apple Watch unlock stop working until you remove the flag. That is the point — those features are what steal the radio — but it is why this is a toggle rather than always-on.

Managed / non-admin Macs

If sudo is locked down (e.g. a work-managed Mac where sudo -l shows only something like (admin) NOPASSWD: /usr/bin/sudo), run the install commands through your admin account by replacing each sudo … with sudo -u admin /usr/bin/sudo …. Once installed, the daemon runs as root on its own, so day-to-day toggling needs no password either way.

Credits

Builds on the well-known macOS streaming-stutter write-ups (the kouwei32 gist, and the AWDL cloud-gaming bug articles). The piece added here is making the suppression survive macOS's automatic re-enable, via the 10-second interval re-assert.

#!/bin/sh
FLAG=/tmp/awdl-down
AWDL=awdl0
if /sbin/ifconfig "$AWDL" 2>/dev/null | grep -q '<UP'; then
is_up=1
else
is_up=0
fi
if [ -e "$FLAG" ]; then
[ "$is_up" -eq 1 ] && /sbin/ifconfig "$AWDL" down
else
[ "$is_up" -eq 0 ] && /sbin/ifconfig "$AWDL" up
fi
exit 0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.awdl-guard</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/awdl-guard.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>10</integer>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StandardErrorPath</key>
<string>/dev/null</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment