Skip to content

Instantly share code, notes, and snippets.

@jnovack
Created January 18, 2017 15:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jnovack/39120926e657d8e54ff5874fdbfdeb16 to your computer and use it in GitHub Desktop.
Save jnovack/39120926e657d8e54ff5874fdbfdeb16 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
@pradeepb28
Copy link

pradeepb28 commented Apr 16, 2022

defaults read /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState

it seems like it returns always 1 on monterey

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