Skip to content

Instantly share code, notes, and snippets.

@crnastena
Created April 18, 2019 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crnastena/6eabec41315629cc0d4c9c9f09335c13 to your computer and use it in GitHub Desktop.
Save crnastena/6eabec41315629cc0d4c9c9f09335c13 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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