Why Use Terminal for Battery Information
MacBook battery terminal commands give you access to detailed battery metrics that System Settings does not show. For example, you can view temperature, raw capacity numbers, and historical logs. You can also automate battery checks and reset power management settings. This guide teaches you the most useful commands.
If your macbook pro battery draining fast after update, Terminal helps you diagnose whether the issue is software or hardware. For general drain fixes, see our pillar post. For understanding cycle counts, see our MacBook battery cycle count guide (cluster post #8). For replacement timing, see when to replace MacBook battery (cluster post #16).
All commands below are run in Terminal (Applications > Utilities). Some commands require sudo (administrator password). You do not need to install any third‑party software.
Command 1: Check Basic Battery Status
The fastest way to get battery percentage and charging state is:
pmset -g batt
Example output:
text
Now drawing from 'AC Power' -InternalBattery-0 (id=1234567) 85% charged (charging)
What the output means:
AC Powermeans plugged in.Battery Powermeans running on battery.- The percentage shows current charge.
(charging)or(discharging)indicates the direction.
Variation for quick percentage only:pmset -g batt | grep -Eo "\d+%"
This returns just the number (e.g., 85%). Useful for scripts.
For a deep dive into pmset, see our macOS pmset commands guide (cluster post #5).
Command 2: View Cycle Count and Maximum Capacity
To see your battery’s cycle count and current maximum capacity compared to when it was new:
system_profiler SPPowerDataType | grep -E "Cycle Count|Full Charge Capacity|Health Information"
Example output:
text
Cycle Count: 342 Full Charge Capacity: 5120 mAh Health Information: Cycle Count: 342 Condition: Normal
What the numbers mean:
- Cycle Count – number of complete charge cycles. Over 1000 means replacement soon.
- Full Charge Capacity – current maximum charge in milliamp‑hours (mAh). Compare to design capacity (see Command 3).
- Condition –
Normal,Service Recommended, orService Now.
For a complete guide to cycle counts, see our MacBook battery cycle count guide (cluster post #8).
Command 3: Get Detailed Battery Health Report
For a more comprehensive report including design capacity, temperature, and voltage:
system_profiler SPPowerDataType
This outputs a lot of information. To filter only battery‑related lines:
system_profiler SPPowerDataType | grep -A 20 "Battery Information"
Key fields to look for:
- Manufacture Date – when the battery was made.
- Design Capacity – original maximum capacity when new.
- Full Charge Capacity – current maximum capacity.
- Cycle Count – wear indicator.
- Temperature – current battery temperature in Celsius.
- Voltage – current voltage (should be 10‑13V depending on charge level).
Calculate battery health percentage:
Divide Full Charge Capacity by Design Capacity, then multiply by 100. For example, 5120 / 5500 = 93%. This is the same as Maximum Capacity in System Settings.
For more on battery health percentages, see our MacBook battery health tips (cluster post #7).
Command 4: Monitor Battery Temperature
Overheating accelerates battery degradation. Use this command to check current temperature:
sudo powermetrics -i 1000 -n 1 | grep -i "battery temperature"
Example output: Battery temperature: 29.8 C
What is normal?
- 20‑35°C (68‑95°F) – normal operating range.
- 35‑45°C (95‑113°F) – warm; may indicate heavy usage or poor ventilation.
- Above 45°C (113°F) – too hot; let your Mac cool down.
Continuous monitoring (every 5 seconds):sudo powermetrics -i 5000 | grep -i "battery temperature"
Press Control + C to stop.
For temperature management tips, see our MacBook battery temperature guide (cluster post #14).
Command 5: Check Which Apps Are Draining Battery
Terminal can show you the same Energy Impact data as Activity Monitor, but in a scriptable format:
top -l 2 -o cpu | head -20
This shows the top CPU‑consuming processes. High CPU usage directly correlates with battery drain.
For a cleaner output focusing on energy:ps -ax -o %cpu,%mem,comm | sort -nr | head -20
To see which apps are preventing sleep (battery drain during sleep):pmset -g assertions | grep -i "PreventUserIdleSystemSleep"
If you see apps listed, they are keeping your Mac awake and draining battery.
For a full guide to identifying battery‑draining apps, see our MacBook battery draining apps guide (cluster post #13).
Command 6: See Battery Logs Over Time
macOS keeps a log of battery events. You can review past charges, discharges, and warnings.
View last day’s battery‑related logs:log show --last 1d --predicate 'eventMessage contains "battery"'
View only warnings and errors:log show --last 1d --predicate 'eventMessage contains "battery"' --level error
Save logs to a file for later analysis:log show --last 7d --predicate 'eventMessage contains "battery"' > ~/Desktop/battery_log.txt
These logs are useful for diagnosing intermittent issues like sudden shutdowns or erratic percentages. If you see frequent “battery temperature” warnings, your Mac is overheating.
For more on log analysis, see our macOS network troubleshooting toolkit (from the Wi‑Fi series, but applicable).
Command 7: Reset Power Management Settings
If your battery settings are corrupted, resetting them to defaults can help. This is especially useful after a macOS update.
sudo pmset -a restoredefaults
What it does: Resets all power management settings (display sleep, computer sleep, wake on network, etc.) to Apple’s recommended defaults. Your personal files and passwords remain unchanged.
When to use it: After an update if your battery drains faster than expected and you have already tried other fixes. Also useful if sleep/wake behavior is erratic.
For Intel Macs only – reset SMC via Terminal (not directly, but you can force a shutdown):sudo pmset -a hibernatemode 0 then sudo shutdown -r now – but SMC reset is still better done manually. See our Intel Mac SMC reset guide for battery issues (cluster post #2).
For a complete pmset reference, see our macOS pmset commands guide (cluster post #5).
Command 8: Check Charge Cycles on External Batteries
If you use an external USB‑C battery pack (power bank), you can sometimes query its cycle count (if the battery supports SMBus reporting). This is less common, but try:
system_profiler SPPowerDataType | grep -A 10 "External Battery"
Not all external batteries report this data. Most will show only basic information.
For USB‑related battery drain from peripherals, see our USB devices battery drain guide (cluster post #12).
Command 9: Monitor Real‑Time Power Usage
For a live view of your Mac’s power consumption in watts:
sudo powermetrics -i 2000 -n 5
This samples power metrics every 2 seconds, 5 times. Output includes:
- CPU power (watts)
- GPU power
- Package total power
- Battery drain rate (mW)
Example output snippet:
text
CPU Power: 1.2W GPU Power: 0.3W Package Power: 2.8W Battery Drain Rate: 3200 mW
Multiply drain rate by time to estimate remaining battery life. For example, 3200 mW drain on a 50Wh battery (50,000 mWh) gives roughly 15.6 hours remaining.
Note: powermetrics requires sudo and may ask for your password. Press Control + C to stop continuous monitoring.
For power management basics, see our macOS battery settings guide (cluster post #10).
Command 10: Save Battery Report to a File
If you need to share battery diagnostics with Apple Support or a technician, save a complete report:
system_profiler SPPowerDataType > ~/Desktop/battery_report.txt
This creates a file on your desktop containing every battery and power‑related metric. You can also email this file to a support representative.
To include system logs as well:log show --last 2d --predicate 'eventMessage contains "battery"' >> ~/Desktop/battery_report.txt
For more on diagnostics, see our Mac performance optimization guide (placeholder).
Terminal vs System Settings: What’s the Difference?
| Feature | System Settings | Terminal Commands |
|---|---|---|
| Battery percentage | Yes | Yes |
| Cycle count | Yes (in Battery Health) | Yes (more detailed) |
| Maximum capacity | Yes (as percentage) | Yes (raw mAh + percentage) |
| Design capacity | No | Yes |
| Battery temperature | No | Yes |
| Historical logs | No | Yes |
| Power drain in watts | No | Yes |
| Reset power settings | No | Yes |
| Ease of use | Easy | Moderate |
Use System Settings for quick checks. Use Terminal for in‑depth diagnostics and automation.
For a comparison of other battery tools, see our MacBook battery health tips (cluster post #7).
Frequently Asked Questions
Q: Do I need to install anything to use these commands?
No. All commands are built into macOS. No third‑party software required.
Q: Why does sudo powermetrics ask for a password?sudo grants administrator privileges. It is required for accessing low‑level hardware sensors.
Q: Can these commands damage my MacBook?
No. They only read data or reset settings to defaults. None of them are destructive.
Q: I see “Condition: Service Recommended” in Terminal. What does it mean?
Your battery has degraded below 80% of its original capacity. Replace it soon. See our when to replace MacBook battery (cluster post #16).
Q: How often should I check my battery with Terminal?
Once every 1‑2 months is sufficient. More frequent checking does not improve battery health.
Q: Can I use these commands on Apple Silicon Macs?
Yes. All commands work on both Intel and Apple Silicon Macs, with the exception of SMC‑related commands (which do not exist on Apple Silicon).
Q: What is the difference between pmset -g batt and system_profiler SPPowerDataType?pmset gives quick live status. system_profiler gives detailed, static information including cycle count and design capacity.
Q: My battery temperature is 45°C. Is that dangerous?
It is high. Let your Mac cool down. Remove cases, ensure vents are clear, and close heavy apps. See our MacBook battery temperature guide (cluster post #14).