How to turn off connections when MacBook lid is closed

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


https://github.com/ppkantorski/Airplane-Sleep

I wrote this script after reading the comments here. Hope it helps someone!