Created
October 24, 2017 06:23
-
-
Save ZoltonMD/983471a1cf828ebf0e4cea7b076f6b7c to your computer and use it in GitHub Desktop.
macos bluetooth restart
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/bash | |
# restart: | |
# > ./restart_bluetooth.sh | |
# turn bluetooth on: | |
# > ./restart_bluetooth.sh 1 | |
# turn bluetooth off: | |
# > ./restart_bluetooth.sh 0 | |
output="Bluetooth restarted"; | |
if [ $# -eq 1 ]; then | |
if [ $1 -eq "1" ]; then | |
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1 | |
output="Bluetooth is on"; | |
elif [ $1 -eq "0" ]; then | |
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0 | |
output="Bluetooth is off"; | |
fi; | |
fi; | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
echo $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment