Limiting a Mac battery after Apple locked the charging keys
On macOS 27 firmware 20457.1 the old charging switches are locked. How chargnr still limits charge, and the safety rules that keep a Mac from draining flat.
Keeping a MacBook plugged in at 100% all day wears the battery faster. A charge limiter stops charging at a level you choose, and several free ones existed. Then Apple changed the firmware, and the usual approach stopped working. chargnr is my free, open-source take on a charge limiter for Apple Silicon, built around that change.
What used to work
Charge limiters talk to the System Management Controller (SMC). Older firmware exposed keys that told it to stop charging, and a different set for Tahoe-era Macs. Which keys exist depends on the firmware version, not the macOS version, so chargnr never branches on versions. It probes for the keys at startup and uses whichever set it finds.
What changed
On firmware 20457.1, which shipped with macOS 27 and in the 15.8 and 26.7 security updates, AppleSMC filters those keys. The keys are still listed, but reading or writing them fails with a "not privileged" error even as root. The gate is a private entitlement that third-party apps cannot get. The adapter switch is the exception: it is still readable and writable as root.
Two ways that still work
- macOS's own charge limit. The system has its own limit for 80% and above, and it works without root and also during sleep. chargnr sets it for you. It accepts any whole number from 80 to 100, not only the 5% steps System Settings shows. Nothing below 80 is possible through it.
- Cutting the adapter. For limits from 20 to 79%, a root helper switches the adapter off so the Mac runs from the battery, and back on at a lower point. It allows any limit, but only while the helper is awake to do the switching, and it adds shallow charge cycles.
How the settings combine
The helper is a root background service that runs the charge loop, so your limit holds even when the app is closed. When several features want different things, the strongest one wins, in this order:
- Force discharge: the adapter stays off until the battery is down to a target you pick, then it clears itself.
- Heat protection: at your temperature limit it stops charging. It resumes only when the battery is 2 °C cooler and at least 5 minutes have passed, so it does not flap on and off.
- Top up: ignores the limit until the battery is full, the charger is unplugged, or 12 hours pass.
- Limit and sailing: stop at the limit, and resume a set number of points below it.
Safety rules matter more than features
A tool that switches your charger off can do real harm if it gets stuck, so most of the work went into what it must never do:
- At or below 10% battery, nothing cuts the adapter, whatever the settings.
- Every write is read back, and charging returns to normal if the helper stops, crashes or is removed.
- The charger is never left off while the Mac sleeps.
- Heat protection that can only cut the adapter stops at 40%, because a hot battery may not cool while the Mac runs from it. I found this in testing with heat protection at 30 °C and a battery idling at 35 °C.
- With the lid closed on an external display, macOS needs wall power to stay awake. chargnr pauses anything that would cut the charger until the lid opens.
From the command line
chargnr status # battery, charging state, what this Mac supports
chargnr limit 80 # stop charging at 80%
chargnr sailing 5 # resume below 75%
chargnr heat 35 # pause charging at 35 °C
chargnr topup # charge to 100% once
chargnr discharge 50 # run from battery down to 50%
chargnr calibrate # full calibration cycle
chargnr history # last 24 hoursTo be fair to the projects that came first: chargnr is written from scratch, but I learned how Apple Silicon charging control works by studying batt and OpenDente. No code is copied, and both are credited in the README.
chargnr also has sailing (let the battery drift a few points below the limit before charging again), a one-time top up, calibration on a schedule, 30 days of history, a command-line tool and Shortcuts actions. It is Apple Silicon only, MIT licensed and installs through Homebrew. The firmware notes, with each key tested and what happened, are in the repository under docs/hardware.md, next to the source on GitHub.
About this project
chargnr — Battery Charge Limiter for Apple Silicon