Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MacOs script to reset bluetooth, when devices cannot connect. Without rebooting. Depends on brew blueutil.
# first install blueutil using homebrew e.g.
# brew install blueutil
echo reset bluetooth script.
blueutil -p 0
echo turned off bluetooth.
# name of wi-fi device is en0 in my instance, you can change it as needed.
networksetup -setairportpower en0 off
sleep 3
echo turned off wi-fi.
networksetup -setairportpower en0 on
# sleep for 3 seconds otherwise bluetooth will start before
# wi-fi startup is complete.
sleep 3
echo turned on wi-fi.
blueutil -p 1
echo turned on bluetooth.
echo completed.
@crnastena

This comment has been minimized.

Copy link
Owner Author

@crnastena crnastena commented Apr 18, 2019

To make file executable remember to do chmod +x reset_bluetooth.sh. Then you can run it ./reset_bluetooth.sh

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