Last active
July 7, 2022 17:56
-
-
Save breiter/9f8aeeb438d9eb6c93aac32988414b9e to your computer and use it in GitHub Desktop.
Restart bluetoothd in macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#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 | |
fi | |
launchd_bluetoothd=$(launchctl list|/usr/bin/grep com.apple.bluetoothd|/usr/bin/awk -F ' ' '{ print $3 }') | |
if [ $launchd_bluetoothd != "com.apple.bluetoothd" ]; then | |
echo "com.apple.bluetoothd LaunchDaemon was not found." >&2 | |
exit 1 | |
fi | |
echo "Restarting bluetoothd. Bluetooth devices will reconnect momentarily." >&2 | |
launchctl stop com.apple.bluetoothd && launchctl start com.apple.bluetoothd | |
exit 0 |
Author
breiter
commented
Dec 17, 2021
•
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