Battery is a command-line and graphical utility for macOS that manages battery charging behavior to prolong battery lifespan. It functions as a charge limiter, allowing users to set a maximum charge threshold—typically 80%—and maintain that limit across reboots and even when the application is closed. The tool also includes a battery sensor calibration feature that discharges the battery to a low level and then fully recharges it to restore accurate capacity reporting.
The project distinguishes itself by offering both a CLI and a GUI for controlling charging behavior, supporting custom percentage targets and manual toggling of the charging circuit regardless of whether the power adapter is connected. It can maintain battery charge within a user-specified percentage range by automatically stopping and resuming charging, and it can drain the battery to a target level by blocking power input from the adapter. Settings persist across system restarts through a state file, ensuring consistent battery protection policies.
Battery provides real-time monitoring of power adapter events through ACPI netlink hooks, adjusting charging behavior in response to plug/unplug events. It runs as a background service managed by systemd, with command-line tools communicating with the daemon via Unix domain sockets or D-Bus. The tool also displays current SMC status, charge percentage, and estimated time remaining.