I want to turn off my MacBook's Wi-Fi automatically when closing its lid.
Is there any software can do this?
I have a battery drain problem. When Wi-Fi is enabled and I close the lid, my MacBook will periodically wake overnight, draining battery.
I have done ton of research and tried many methods. Turning off the Wi-Fi before closing the lid is the only way to guarantee that my MacBook will not wake. But, well, it is annoying to disable Wi-Fi every time. So I need a script or other software to do this job.
Best Answer
You could combine DFGKApps's script for turning off Wifi and DssW's Power Manager to run the script on sleep.
The Terminal.app command to disable WiFi appears to be:
To re-enable WiFi use:
Be sure to test these commands using Terminal.app, as I suspect they may require tweaking depending on your network set up.
Be aware that running a script on sleep does come with limitations. The time available for the script is short and can not be extended.
I am a software engineer involved with Power Manager, so feel free to ask technical questions about how to use it.