MacOS – How to turn off connections when MacBook lid is closed

bluetoothmacbook promacossleep-wakewifi

I have a friend who wants his connections (WiFi, Bluetooth, ext…) to turn off when his lid is closed. He doesn't want to change a lot of settings (sleep mode, turning it off manually …).

Is there a simple way to do this through macOS System Preferences? Or a way with some program?

Best Answer

You could install blueutil and SleepWatcher via homebrew and set a .sleep code to call blueutil in order to disable bluetooth and call "networksetup -setairportpower en0 off" to disable wifi when going to sleep mode or closing the lid.

Blueutil comands are "/usr/local/bin/blueutil -p 0" to disable bluetooth and blueutil -p 1 to enable it.

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 enable back connections when waking up the mac.

You can find out how to use sleepwatcher here