Enabling Bluetooth via Terminal

Pdallison
New Contributor III

Good morning,

We recently upgraded our MacBook fleet to MacBook M1 Apple Silicon. Our old scripts that allowed us to force bluetooth back on does not work anymore do the restrictions of Apple Silicon. I was checking if any found a to turn bluetooth on using terminal? I found the  /usr/sbin/bluetoolctl in terminal but it only shows if the power is on for bluetooth but nothing else.

1 ACCEPTED SOLUTION

_Daley
New Contributor III

You could consider using blueutil to do this: 

https://github.com/toy/blueutil

 

View solution in original post

7 REPLIES 7

snowfox
Contributor III

This is related and may be of use to you.  I force Bluetooth off in our student labs via Configuration Profile.

Preference Domain:    com.apple.MCXBluetooth

Custom Applications & Settings:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>DisableBluetooth</key>
    <true/>
  </dict>
</plist>

Try setting the true to false.  This might force it on.  Not sure, haven't tried it as we only force it off in student labs.

Pdallison
New Contributor III

I just tried your profile config. It works, but if enduser decides to turn off BT again after it was force back on it will remain off.

mvu
Valued Contributor III

This is the script from CIS to disable:

• 2.3.3.11 Ensure Bluetooth Sharing Is Disabled (Automated)

 

Edit: My bad - this is for Bluetooth Sharing. 
% /usr/bin/sudo -u <username> /usr/bin/defaults -currentHost write
com.apple.Bluetooth PrefKeyServicesEnabled -bool false
% /usr/bin/sudo -u firstuser /usr/bin/defaults -currentHost write
com.apple.Bluetooth PrefKeyServicesEnabled -bool false

 

You could massage the script, and flip "false" to "true."

PaulHazelden
Valued Contributor

I am using a script, to turn it off or on, and so far it works on Sequoia for me.

# Turn on Bluetooth service
/usr/bin/defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1

Use a 0 to turn it off.
One day I may go fully down the configuration profiles route, but not yet.
As with all scripts you get from the internet, Test, Test, and Test again before sending it to production.

pete_c
Valued Contributor

You've got a capital B in Bluetooth.  On two 15.4 Macs, I see it as lowercase.

_Daley
New Contributor III

You could consider using blueutil to do this: 

https://github.com/toy/blueutil

 

Pdallison
New Contributor III

I tested blueutil and it works.