Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
Forked from jnovack/bluetooth.sh
Created January 28, 2018 07:11
Show Gist options
  • Save jtbonhomme/f5ff149b4f0deee7bc6449544e35bbab to your computer and use it in GitHub Desktop.
Save jtbonhomme/f5ff149b4f0deee7bc6449544e35bbab to your computer and use it in GitHub Desktop.
Control Bluetooth Daemon through Command Line OSX
#read the current pref, returns '0' for off and '1' for on.
defaults read /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState
#set bluetooth pref to off
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0
#set bluetooth pref to on
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1
#kill the bluetooth server process
sudo killall blued
#unload the daemon
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
#reload the daemon
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist
#start the daemon
sudo launchctl start com.apple.blued
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment