Skip to content

aos battery

Battery presence and charge

3 commands. Run aos battery --help for the same list from the binary, or see every group.

Battery facts for laptops. status prints the charge and whether it is charging, percent prints a bare number for scripts, and present exits 0 or 1 so a script can branch on whether there is a battery at all. On a desktop, present exits 1 and the others say no battery. status also shows battery health where the OS reports it: full-charge capacity against design capacity (the Maximum Capacity figure in macOS System Settings), cycle count, and pack temperature.

Print the charge percentage as a bare number

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos battery percent
Terminal window
aos battery percent # 87

Exit 0 when a battery is present, 1 otherwise

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos battery present
Terminal window
aos battery present && echo has a battery

Print battery charge, charging state, and health (capacity, cycles) where reported

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos battery status [--json]
flag values meaning
--json Optional
Terminal window
aos battery status # 87% discharging 3:41 remaining (health 97%, 15 cycles, 30.7°C)
aos battery status --json