0

I'm trying to find out how to turn Bluetooth On or Off by using the Terminal on macOS Catalina.

I used to be able to do it with the following commands:

alias bton="sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1"
alias btoff="sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0 && \sudo killall -HUP blued"

Unfortunately these no longer work.

0

1 Answer 1

7

Blueutil, a command-line utility for macOS that lets us turn Bluetooth on and off with one command!

Start by installing blueutil with HomeBrew:

brew install blueutil

The -p flag is a switch for turning Bluetooth on and off:

Turn bluetooth off

blueutil -p 0

Turn bluetooth on

blueutil -p 1
3
  • 1
    This is also the accepted answer on the potential duplicate.
    – anki
    Commented Jan 8, 2020 at 15:40
  • 4
    is there no method of doing this without having to install a 3rd party app?
    – esaruoho
    Commented Jan 9, 2020 at 15:29
  • @esaruoho A third party app is bad enough, but this requires an entire third-party library...
    – Alex
    Commented May 19 at 23:50

Not the answer you're looking for? Browse other questions tagged .