explaingit

actuallymentor/battery

6,995ShellAudience · generalComplexity · 1/5Setup · easy

TLDR

Free macOS tool for Apple Silicon Macs that caps battery charging at a custom percentage to slow battery aging, available as a menu-bar app or command-line tool, with settings that persist across reboots.

Mindmap

mindmap
  root((battery))
    What it does
      Cap charge percent
      Custom charge range
      Extends battery life
    Two interfaces
      Menu bar app
      Command line tool
    Key behavior
      Persists after reboot
      Calibration command
      Hardware level control
    Requirements
      Apple Silicon only
      M1 M2 M3 chips
      Homebrew install
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Keep a plugged-in MacBook charged at 80% instead of 100% to extend long-term battery health

USE CASE 2

Set a custom charge range like 70, 80% from the terminal for precise control over when charging starts and stops

USE CASE 3

Run a full battery calibration cycle with one command to discharge and recharge the battery completely

Tech stack

Shell

Getting it running

Difficulty · easy Time to first run · 5min

Only works on Apple Silicon Macs (M1, M2, M3), not compatible with Intel-based Macs.

In plain English

Battery is a free, open-source tool for Apple Silicon Macs (the M1, M2, and M3 chip models) that lets you cap how high your battery charges. The main use case is keeping a laptop that stays plugged in most of the time at 80% charge, which is a well-documented way to slow down battery aging over time. It is not compatible with older Intel-based Macs. You can use it two ways. The first is a menu-bar app with a simple interface that sits in your system tray, which you install through Homebrew or by downloading a disk image from the releases page. The second is a command-line tool for people comfortable with a terminal, which lets you set custom charge limits or ranges, like keeping the battery between 70% and 80%. Installing the menu-bar app automatically installs the command-line tool as well. The tool works by talking directly to your Mac's hardware controller to enable and disable charging. When you set a limit, it stays active across reboots and even after closing the menu-bar app, so you do not need to remember to turn it back on. It also includes a calibration command that runs the battery through a full discharge and recharge cycle. The README explains clearly how this differs from Apple's own Optimized Battery Charging feature. Apple's built-in version uses machine learning and adapts to your charging schedule automatically, while this tool gives you manual, consistent control over the exact percentage at which charging stops and starts. The author originally built the command-line version as a holiday side project after finding the license of a similar paid app too restrictive, then added the graphical interface after a colleague asked for one. The app contacts a few external URLs for update checks and anonymous install counting (tracking only unique IP addresses, not personal data). Blocking those URLs will only break automatic updates, not the core charging functionality.

Copy-paste prompts

Prompt 1
I have a MacBook M2 that stays plugged in all day, walk me through installing the battery tool via Homebrew and setting an 80% charge limit
Prompt 2
Using the battery command-line tool, show me how to set a charge range between 65% and 80% and verify the limit survives a reboot
Prompt 3
What is the difference between this battery tool and Apple's built-in Optimized Battery Charging, and when should I use one over the other?
Open on GitHub → Explain another repo

← actuallymentor on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.