Mac Battery Life Command Line: Get Info in Terminal
To get battery life information from the command line on macOS, open Terminal and run pmset -g batt. This shows the current battery charge percentage, charging state (charging, discharging, or finished), and whether the battery is drawing power from the AC adapter. For more detailed health data, use system_profiler SPPowerDataType to see cycle count, condition, and maximum capacity.
Why Use the Command Line for Battery Info?
Most Mac users check battery status by clicking the battery icon in the menu bar. That gives a quick percentage and time estimate, but it hides deeper data. The command line reveals the same info plus details that the GUI doesn’t show, such as cycle count, battery condition (Normal, Service Recommended, Replace Soon), and the exact power source. It’s especially useful when you’re writing scripts, monitoring battery health over time, or troubleshooting a Mac that seems to drain too fast. Terminal commands work on all recent macOS versions (Mojave through Sonoma and later) and on both Intel and Apple Silicon Macs.
Basic Commands: pmset and system_profiler
The two most important commands are pmset and system_profiler. Here’s what each does:
pmset -g batt– Shows the current battery state: percentage, remaining time (if the system can estimate it), and whether it’s on AC power or battery.pmset -g ps– Same as above but with slightly different formatting; useful for scripting.system_profiler SPPowerDataType– Displays battery health: cycle count, condition, maximum capacity, and whether the battery is currently charging.pmset -g log | grep -i battery– Shows battery-related log entries, helpful for diagnosing sudden drops or charging issues.
For a one-liner that shows both charge and health, combine them: pmset -g batt; system_profiler SPPowerDataType | grep -E "Cycle Count|Condition|Maximum Capacity".
Understanding the Output
When you run pmset -g batt, you’ll see output like this:
Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 75%; discharging; 2:34 remaining
Here’s how to read it:
- Drawing from: ‘Battery Power’ or ‘AC Power’ – tells you if the Mac is on battery or plugged in.
- 75%: Current charge percentage.
- discharging: The battery is being used. Other states are ‘charging’, ‘charged’ (or ‘finishing charge’), and ‘AC attached’ when plugged in.
- 2:34 remaining: Estimated time until empty (when discharging) or until full (when charging). This estimate is based on current usage and can fluctuate.
For system_profiler SPPowerDataType, look for these fields:
- Cycle Count: Number of complete charge/discharge cycles. Mac batteries are typically rated for 1000 cycles (on modern Macs) before capacity drops noticeably.
- Condition: ‘Normal’ means the battery is healthy. ‘Replace Soon’ or ‘Service Recommended’ means the battery should be serviced.
- Maximum Capacity: Percentage of original capacity the battery can still hold. Below 80% is often considered degraded.
How to Check Battery Health and Cycle Count
To see the battery’s overall health, run:
system_profiler SPPowerDataType
Look for the Health Information section. It shows Cycle Count, Condition, and Maximum Capacity. For example, a Mac with 300 cycles and 95% maximum capacity is still in good shape. If the condition says ‘Service Recommended’, the battery may need replacement, even if the percentage looks fine. Apple considers a battery to be worn when it reaches 80% of its original capacity or 1000 cycles, whichever comes first.
Monitoring Battery Over Time
If you want to track battery drain or charging speed, you can sample the battery status at intervals. For instance, to log the percentage every 60 seconds, use:
while true; do pmset -g batt | head -n 2; sleep 60; done
This prints the status every minute until you press Ctrl+C. You can redirect the output to a file to keep a log: while true; do pmset -g batt | head -n 2 >> battery_log.txt; sleep 60; done. This is handy for spotting abnormal drain while your Mac is asleep or idle.
Common Problems and Fixes
Sometimes the command line doesn’t give the expected info. Here are common issues:
- No time remaining shown: macOS often hides the time estimate when the battery is too low or when the system can’t predict usage. It’s normal; the percentage is still accurate.
- Condition says ‘Service Recommended’ but battery works fine: This is a warning that the battery is losing capacity. It’s safe to keep using it, but you may see shorter battery life. Back up your data and consider replacement.
- pmset command not found: This is rare; pmset is part of macOS. If it’s missing, your system may be corrupted. Try running
/usr/bin/pmset -g battwith the full path. - system_profiler shows no battery info: On a desktop Mac (iMac, Mac Pro, Mac mini) there is no internal battery, so the command returns nothing. That’s expected.
Alternatives to the Command Line
If you’re not comfortable with Terminal, there are GUI alternatives. The System Settings app (or System Preferences on older macOS) has a Battery pane that shows usage history and health. You can also hold the Option key and click the battery icon in the menu bar to see condition and cycle count. Third-party apps like coconutBattery and iStat Menus display the same data with charts, but they cost money or require installation. The command line is free and always available.
Frequently Asked Questions
How do I see battery percentage in Terminal?
Run pmset -g batt. The output includes the percentage, e.g., 75%. If you want just the number, use pmset -g batt | grep -o '[0-9]*%'.
What is a good cycle count for a Mac battery?
Modern MacBooks are rated for 1000 cycles. A cycle is one full discharge and recharge. If your cycle count is below 500 and capacity is above 90%, the battery is in good shape. Above 1000 cycles, expect reduced battery life.
Why does my Mac show ‘Service Recommended’?
macOS flags a battery as ‘Service Recommended’ when its maximum capacity drops below 80% or when the battery can’t deliver enough power. It doesn’t mean the battery is unsafe, but it should be replaced soon to restore full performance.
Can I check battery health on an older Mac?
Yes, the same commands work on macOS 10.9 and later. On very old versions, system_profiler SPPowerDataType may show fewer fields, but cycle count and condition are usually present.
Does using Terminal to check battery drain battery?
Running a single command uses negligible power. However, a loop that runs every second could slightly increase CPU usage. The built-in commands are lightweight and won’t noticeably affect battery life.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.