Created
April 18, 2019 05:57
-
-
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.
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
# 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To make file executable remember to do
chmod +x reset_bluetooth.sh
. Then you can run it./reset_bluetooth.sh