Get MacBook Battery Life Percent Time Remaining from Command Line in Mac OS X
While most Mac laptop users will rely on the battery percentage indicator found in the menu bar of OS X, those who spend a lot of time at the command line may find it useful to know that MacBook battery life and battery charge percentage remaining information can be retrieved directly from the Terminal in Mac OS X.
This trick works to retrieve battery details on all Mac laptops in just about every version of OS X out there, whether it’s a MacBook Pro, MacBook Air, or MacBook.
Even if you aren’t a heavy command line user, this is a simple enough tip that anyone can get battery life info about their Mac this way, so just fire up the Terminal app and enter the appropriate pmset syntax.
How to View Battery Percentage, Battery Life Remaining, & Battery Charge Status of a Mac from the Command Line in OS X
The command to get battery information, including percentage, time remaining, battery source, and battery charge status, is as follows:
pmset -g batt
Hit return as usual and you’ll see something like the following, assuming you’re currently running off a MacBook battery:
% pmset -g batt
Now drawing from 'Battery Power'
-InternalBattery-0 90%; discharging; 6:32 remaining
If the MacBook Pro / Air is connected to a MagSafe AC power adapter, the pmset command will report “AC Power” and display the status of the battery charging.
% pmset -g batt
Now drawing from 'AC Power'
-InternalBattery-0 100%; charged; 0:00 remaining
And if the MacBook is actively charging, you’ll also get information about current charge percentage and the time remaining until there is a full charge:
% pmset -g batt
Now drawing from 'AC Power'
-InternalBattery-0 92%; charging; 0:12 remaining
Of course if you use this command on a Mac that does not have an internal battery it won’t report anything, which is to be expected.
While the pmset command details specifics about the Macs internal battery, you can also get battery info about connected devices. Another helpful trick is to get Bluetooth device battery levels from the command line as well using a different command, which is great for users of a wireless keyboard and mouse.
The command line is generally geared towards more advanced users, and you can find the same type of information from the friendlier UI on the Mac through the battery menu bar and the Bluetooth menu bar too. If you notice your battery life is not performing as expected, you can find out what apps are using battery and energy and take action by either quitting them or ending the processes forcefully.
pmset -g rawbatt
AC; No battery; Not Charging; NaN%; Cap=0: FCC=0; Design=-1; Time=0:00; 0mA; Cycles=0/-1; Location=0;
Polled boot=01/28/2023 08:30:13; Full=01/28/2023 10:21:14
hmm doesnt seem to work on osx 10.3
pmset -g rawbatt
AC; No battery; Not Charging; NaN%; Cap=0: FCC=0; Design=-1; Time=0:00; 0mA; Cycles=0/-1; Location=0;
Polled boot=01/28/2023 08:30:13; Full=01/28/2023 10:21:14
Great little article Paul….remember when we could check the number of recharges on our laptops,and I think, numbers of hours of use?…..used to be fun to compare battery life, and longevity… i have an ipod 3…..the battery died a long time ago…i can still use but not on my current mbpro…and was a little disappointed to read ‘no more ipods’.
You can continue to get battery charge cycle count on Macs in OS X through System Information
https://osxdaily.com/2011/06/23/check-battery-cycle-count-mac/