Here are some tips I use to optimize battery life on my MacBook Pro. Being aware of energy hogging apps (all browsers) and pausing them can extend your battery life to what Apple advertises.
- Open Activity Monitor and switch to the Energy pane. This will tell you who the big offenders are. Chrome is a notorious energy hog, but Safari would be #1 too if you're using it to do a lot of browsing. If there's anything else in there which isn't obvious (like video players, bitcoin miners ;) then you may want to shut them down while you're on battery power. You can also get a summary of "Apps using significant energy" by clicking on tbe battery icon in the top right. This is where we will check our progress in improving battery life each time we make a change.
Now that you've identified the energy suckers, you can either close them if you don't need them anymore, or you can pause them. Users generally don't know that applications can be paused instead being closed or quit. To pause an app, select it in Activity Monitor and then go to View -> Send Signal to Process in the menu bar. Very few Mac users know what a (POSIX) signal is or how they can be useful. Now you do. You'll get a popup with "Please select a signal to send to the process" with a dropdown. Choose STOP (SIGSTOP) and click Send. Now if you try to switch to that application, it won't respond. And in Activity Monitor it will appear as "(Not Responding)" in red. If you check the CPU tab you'll see that it's not taking any CPU. Success!
Later, when you want to resume that app, you can do the same thing but send Continue (SIGCONT). Your app will now be responding, taking up CPU and energy again.
Sending signals and SIGSTOP/SIGCONT are just a normal feature of Unix. This is how we communicate with processes and how processes communicate with each other, by sending signals. There's more which can be done by sending signals to Unix processes and you can even quit an app this way. It's often quicker to do this from the command-line and in OS X, just open a Terminal window, find out the Process ID (PID) from the CPU tab, and run "kill -STOP $PID" and "kill -CONT $PID", replacing $PID with the numerical process ID you got frmo Activity Monitor.
- Besides the CPU, you can reduce energy consumption in other parts of your Mac's hardware. A simple thing you can do to lengthen battery life on a MacBook is dim the screen from full strength to the minimum you need to use and read the screen.
You should also turn off Bluetooth if it's enabled, and even wifi if you don't need it right now. You probably don't need backlighting on your keyboard if you use that, unless it's also really dark (in which case you can probably turn down your screen lighting). Also, disconnect any external devices.