You can find this information along with much other battery and/or system information from the command
ioreg
This command, according to its man page, does:
ioreg displays the I/O Kit registry. It shows the heirarchical1 registry
structure as an inverted tree.
1: heirarchical [sic]
Using a filter by class name (AppleSmartBattery
for battery) to get only battery-related information:
$ ioreg -brc AppleSmartBattery
-b Show the object name in bold.
-r Show subtrees rooted by objects that match the specified criteria.
If none of -c, -k, or -n are supplied, -r has no effect.
-c Show the object properties only if the object is an instance of, or
derives from, the specified C++ class (e.g. IOService).
From man ioreg
.
Will print something like this:
$ ioreg -brc AppleSmartBattery
+-o AppleSmartBattery <class AppleSmartBattery, id 0x100000254, registered, ma$
{
"ExternalConnected" = Yes
"TimeRemaining" = 0
"InstantTimeToEmpty" = 65535
"ExternalChargeCapable" = Yes
"FullPathUpdated" = 1464849055
"CellVoltage" = (4298,4292,4299,0)
"Voltage" = 12889
"BatteryInvalidWakeSeconds" = 30
"AdapterInfo" = 0
"MaxCapacity" = 5524
"PermanentFailureStatus" = 0
"Manufacturer" = "SMP"
"Location" = 0
"CurrentCapacity" = 5524
"LegacyBatteryInfo" = {"Amperage"=0,"Flags"=5,"Capacity"=5524,"Current"=5$
"FirmwareSerialNumber" = 1
"BatteryInstalled" = Yes
"PackReserve" = 200
"CycleCount" = 318
"DesignCapacity" = 6330
"OperationStatus" = 58371
"ManufactureDate" = 17726
"AvgTimeToFull" = 65535
"BatterySerialNumber" = "D864403T3UVFVN7A6"
"BootPathUpdated" = 1464353527
"PostDischargeWaitSeconds" = 120
"Temperature" = 3096
"UserVisiblePathUpdated" = 1464849490
"InstantAmperage" = 0
"ManufacturerData" = <000000000702000a03890000034a34340330304103534449032$
"MaxErr" = 1
"FullyCharged" = Yes
"DeviceName" = "bq20z451"
"IOGeneralInterest" = "IOCommand is not serializable"
"Amperage" = 0
"IsCharging" = No
"DesignCycleCount9C" = 1000
"PostChargeWaitSeconds" = 120
"AvgTimeToEmpty" = 65535
}
The field you are looking for is DesignCapacity
. For convenience, filter it out with grep
(unit is milliamp-hours, or mAh):
$ ioreg -brc AppleSmartBattery | grep DesignCapacity
"DesignCapacity" = 6330
Your DesignCapacity
field may not display 6330
as its value. I'm using a 13" mid-2014 rMBP, but you may be using another system with different battery ratings.
Apart from battery information, ioreg
can be used to find out more about your system and other peripherals - somewhat like a command-line System Information tool.
If you're looking for a code-implementation of this command, take a look at Beltex's SystemKit over on Github. It's one of the coolest Swift libraries I know of.
Disclaimer: not affiliated to SystemKit or Beltex. Just a happy user of SystemKit.