Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Restart bluetoothd in macOS
#kill bluetoothd to reset bluetooth wonkiness in macOS
#catalina, big sur, monterey
#fixes continuity, magic keyboard mismapping of function keys, magic mouse scrolling
current_userid=$(id -u)
if [ $current_userid -ne 0 ]; then
echo "$(basename "$0") requires superuser privileges to run" >&2
echo "try: \033[1;36msudo $(basename "$0")" >&2
exit 1
launchd_bluetoothd=$(launchctl list|/usr/bin/grep|/usr/bin/awk -F ' ' '{ print $3 }')
if [ $launchd_bluetoothd != "" ]; then
echo " LaunchDaemon was not found." >&2
exit 1
echo "Restarting bluetoothd. Bluetooth devices will reconnect momentarily." >&2
launchctl stop && launchctl start
exit 0
Copy link

breiter commented Dec 17, 2021

curl -L -o bluetooth-restart
chmod +x bluetooth-restart 
sudo ./bluetooth-restart

Copy link

breiter commented Jan 13, 2022

This fixes wonky bluetooth keyboard function key mappings and Continuity when it stops working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment