Disable wifi and bluetooth when closing your MacBook or putting it to sleep!
Here's a few simple commands that might help with saving battery life. The configuration files should work on other versions of macOS, but I have not tested it yet myself. Apparently wifi and bluetooth are still active when the MBP is closed and if you have something like Dropbox running, it could contribute to significant power drain. Turning the antennas off can save battery and prevent some data from being transferred during sleep mode.
- Mount Airplane-Sleep.dmg. You may need to make the installer executable. Open Terminal then type in
chmod +x /Volumes/Airplane-Sleep/install.command
-
Double-click on the install.command file.
-
Allow the installer to everything. You may be asked to change security preferences for "input monitoring" on your MacBook to allow the Homebrew package "sleepwatcher" to function properly.
Now when the computer sleeps, it will automatically disable wifi if it's on and bluetooth if it's on as well. If one of them are already turned off, it will remain off when sleep is disengaged.
- Open Terminal and type in
chmod +x /Volumes/Airplane-Sleep/uninstall.command
-
Double-click on the uninstall.command file.
-
Allow the uninstaller to remove what ever you want from what was installed.
Click to expand!
- Run command on Terminal to install the Homebrew package manager.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install command-line tools for controling bluetooth and executing sleep commands. You may be asked to change security preferences for "input monitoring" on your MacBook to allow sleepwatcher to function properly.
brew install blueutil
brew install sleepwatcher
brew services start sleepwatcher
- Move the hidden files ".sleep" and ".wakeup" from the .dmg into your user home directory. Initialize file for ".bluestatus" and ".wifistatus". Change permissions for each file.
cp /Volume/Airplane-Sleep/.sleep ~/
cp /Volume/Airplane-Sleep/.wakeup ~/
echo 1 > ~/.bluestatus
echo 1 > ~/.wifistatus
chmod +x ~/.sleep
chmod +x ~/.wakeup
chmod +x ~/.bluestatus
chmod +x ~/.wifistatus
Click to expand!
- Uninstallation of configuration files.
rm -rf ~/.sleep
rm -rf ~/.wakeup
rm -rf ~/.bluestatus
rm -rf ~/.wifistatus
- Uninstallation of Homebrew packages.
brew remove blueutil
brew services stop sleepwatcher
brew remove sleepwatcher
- Uninstallation of Homebrew (optional).
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Hibernation is a super useful feature, especially with fast SSDs. It might also be worth changing the sleep standby delay before hibernation. These commands change the delay after sleeping to entering hibernation when on low power to 10 minutes (600 sec) and when on high power to 20 minutes (1200 sec).
sudo pmset -a standbydelaylow 600
sudo pmset -a standbydelayhigh 1200
Disabling TurboBoost can also increase your battery but I doubt it will change anything with sleepmode... Still, it's worth checking out.