I would like to get the number of recharge cycles using bash (terminal commands). I understand the following command will display all of the battery data, but I want the cycle count on its own

ioreg -l -w0 |grep Capacity

I use the following command to get the battery percentage, so I imagine it can be modified slightly to get the cycle count instead;

ioreg -l | awk '$3~/Capacity/{c[$3]=$5}END{OFMT="%.3f";max=c["\"MaxCapacity\""];print(max>0?100*c["\"CurrentCapacity\""]/max:"?")}'

I'm new to bash, so I'm not completely sure how that code works, or how I'd adapt it for my needs.

Any help would be appreciated. Thanks.

2 Answers 2


Something like

system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'

should do the job.

system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}'

will get you the battery condition, for example: Normal.

If you want more output, run:

system_profiler SPPowerDataType | grep -A3 -B7 "Condition"

to get something similar to this:

      Charge Information:
          Charge Remaining (mAh): 2405
          Fully Charged: No
          Charging: No
          Full Charge Capacity (mAh): 3816
      Health Information:
          Cycle Count: 187
          Condition: Normal
      Battery Installed: Yes
      Amperage (mA): -2635
      Voltage (mV): 11212
  • 1
    How about battery condition?
    – BenSmith
    Commented Feb 2, 2017 at 22:16
  • 6
    @BenSmith system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}' will get you the battery condition
    – joni
    Commented Apr 8, 2018 at 5:29
  • Unfortunately system_profiler is not available in the safe boot environment.
    – Berik
    Commented May 2, 2021 at 17:13
  • 1
    If you're having problems doing this from Terminal in recovery mode, just run chroot /Volumes/Macintosh\ HD zsh first, then run the above commands
    – bdev
    Commented Oct 16, 2022 at 18:56
system_profiler SPPowerDataType | grep -A3 -B7 "Power"

I just do this, and it will do the things.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .