41

A case in point: I have Bluetooth headphones connected to my MacBook Pro, I close the lid and want to connect headphones to my iPhone. I can't do that because the MBP ↔ headphones connection is still persisted.

How do I configure macOS so that Bluetooth is turned off or Bluetooth connections are disconnected whenever lid is closed?

I'm using macOS Mojave 10.14.5.

5 Answers 5

20

You could install blueutil and SleepWatcher via homebrew and set a .sleep code to do "/usr/local/bin/blueutil -p 0" when going to sleep mode.

To use SleepWatcher, make a shell script in your home directory named .sleep and give it permission with the chmod command.

You also can do a .wake code to turn bluetooth back on with blueutil -p 1

You can find out how to use sleepwatcher here

3
  • No need to use AppleScript, you can use Bash commands directly in the .sleep/.wake files.
    – syntagma
    Jul 24, 2019 at 6:05
  • 1
    Good catch, just edited my answer !
    – Edd Growl
    Jul 25, 2019 at 13:12
  • I'm having the same problem with Mac 2016/17 but not with my MacBook late 2013 which I strongly feel is superior device. Is there a way to only turn the audio Bluetooth off when the lid is closed so Bluetooth mouse or keyboard can wake it up?
    – awm
    Jun 25, 2021 at 2:19
42

I created a little menubar app which turns off bluetooth when your Mac is sleeping (it's free). Hope it helps!

3
  • 1
    That's really helpful! Jun 22, 2021 at 14:20
  • 1
    This is really cool. One question though, is it possible to get the Mac to reconnect headphones after waking up? For me, the BT adapter is enabled again, but previous connections are not re-established.
    – JHH
    Sep 24, 2021 at 12:48
  • 2
    @JHH from my experience I think it depends on the device unfortunately - I have power cycle my Bose headphones to get them to scan & reconnect.
    – odlp
    Sep 29, 2021 at 7:53
6

I created a script that does all of what @edd-growl mentions above, for you. https://github.com/alb12-la/KBOS

4

In addition/as an update to Edd Growl's answer, this post on MacRumors includes making the files executable and a new path for blueutil that I needed to get it working on my M1 MacBook:

brew install sleepwatcher blueutil
echo "$(which blueutil) -p 0" > ~/.sleep
echo "$(which blueutil) -p 1" > ~/.wakeup
chmod 755 ~/.sleep ~/.wakeup
brew services restart sleepwatcher

They've removed the option to disable waking by Bluetooth from Monterey (12.2.1) so this was the only solution that worked for me.

3

You can automate this using BetterTouchTool - automations (https://folivora.ai/):

configuration

note: Don't be afraid to pay $20 for the whole tool, it will pay for itself in no time. The tool is must have for anyone working seriously on macos in my opinion as it adds so many features missing in standard macos.

2
  • Hi! I don't see such an option in my licensed copy of BTT. Can you help me make this change? May 6 at 7:46
  • @AbhishekJain Please specify what you don't see - Automations or Enable/Disable Bluetooth? You can also check folivora forums/manual for help, rather keep this focused around answers themselves.
    – Petr
    May 10 at 8:11

You must log in to answer this question.

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