Use ioreg command to get battery cycle count

Feb 16, '05 10:18:00AM

Contributed by: panasonic

Apparently, since the OS X 10.3.8 update, the ioreg command now also shows battery cycle count on Apple laptops. By issuing the following command...

ioreg -l | grep Capacity
...the cycle count information is displayed among the other known battery information. For my band new Powerbook battery, the cycle count stands at 10. Your mileage may vary...

[robg adds: A previous hint goes into great detail on ioreg, and includes a script for checking some of its values. On my machine, the output of the above command is as shown below. It takes a few seconds to run, given the length of the output from ioreg -l (try it sometime!).
$ ioreg -l | grep Capacity
    | | |   "IOBatteryInfo" = ({"Capacity"=3971,"Amperage"=0,
            "Cycle Count"=43,"Current"=3962,"Voltage"=12493,
            "Flags"=838860805,"AbsoluteMaxCapacity"=4200})
    | |   |   |     "IOBatteryInfo" = ({"Capacity"=3971,
                    "Amperage"=0,"Cycle Count"=43,"Current"=3962,
                    "Voltage"=12493,"Flags"=838860805,
                    "AbsoluteMaxCapacity"=4200})
Note that I have wrapped the lines by hand -- they're actually really wide single lines. If you don't set your Terminal window *really* wide, though, you won't see all the output; it gets chopped with a $ symbol. Is there a "wrap" option on grep that I'm not aware of?]

Comments (33)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050213125925746