WhatBattery CLI
The same battery engine in your terminal.
Get a readable snapshot, stream changing values, feed JSON into scripts, or export Pro history without opening the menu bar app.
A useful default
Run one command. Get the important facts.
The CLI and app share the same battery readers and formatting. The default output is designed for humans; --json exposes structured data for scripts.
- Battery health and raw capacity
- Charge state and cycles
- Temperature, voltage, and live power
- Model and charger context
~ whatbattery
Model MacBook Pro (14-inch, M5)
Health 99.6% (6,225 / 6,249 mAh)
Charge 100%, fully charged
Cycles 42 (design 1000)
Temperature 30.4°C
Power 0.0 W (100W PD charger)
Voltage 13.21 V
Model MacBook Pro (14-inch, M5)
Health 99.6% (6,225 / 6,249 mAh)
Charge 100%, fully charged
Cycles 42 (design 1000)
Temperature 30.4°C
Power 0.0 W (100W PD charger)
Voltage 13.21 V
Commands
Readable, structured, or live.
whatbattery # readable battery summary
whatbattery --json # structured JSON
whatbattery --watch # refresh as values change
whatbattery --accessories # connected accessory levels
whatbattery --idevice # iPhone/iPad reading (Pro)
whatbattery --version
whatbattery --help
Pro commands
whatbattery --report
whatbattery --export csv --range month
whatbattery --export json --range all --out history.json
whatbattery --activate XXXX-XXXX-XXXX-XXXX
whatbattery --licence
whatbattery --deactivate
Install the CLI
Homebrew installs the menu bar app and symlinks the bundled command into your PATH:
brew install --cask darrylmorley/whatbattery/whatbatteryIf you installed the app manually, the binary is inside WhatBattery.app/Contents/Helpers/whatbattery.
Automation examples
Extract the current health with jq:
whatbattery --json | jq '.healthPercent'Keep a live view while testing chargers:
whatbattery --watchInstall the app and CLI together.
The Homebrew cask gives you both and keeps upgrades simple.