actuallymentor /battery
CLI/GUI for managing the battery charging status for Apple silicon (M1, M2, M3) Macs
★ 7,200⑂ 301👁 39⑃ 78● 379▤ 31
7,200
stars
+0+2+10
301
forks
39
watchers
78
prs
379
issues
31
releases
–
discussions
README
Battery charge limiter for Apple Silicon Macbook devices
This tool makes it possible to keep a chronically plugged in Apple Silicon Macbook at 80% battery, since that will prolong the longevity of the battery. It is free and open-source and will remain that way.
Want to know if this tool does anything or is just a placebo? Read this excellent article. TL;DR: keep your battery cool, keep it at 80% when plugged in, and discharge it as shallowly as feasible.
Requirements
This is an app for Apple Silicon Macs. It will not work on Intel macs. Do you have an older Mac? Consider the free version of the Al Dente software package. It is a good alternative and has a premium version with many more features.
Installation
- Option 1: install through brew with brew install battery
- Option 2: You can download the latest app dmg version here.
- Option 3: command-line only installation (see section below)
The first time you open the app, it will ask for your administator password so it can install the needed components. Please note that the app:
- Discharges your battery until it reaches 80%, even when plugged in
- Disables charging when your battery is above 80% charged
- Enabled charging when your battery is under 80% charged
- Keeps the limit engaged even after rebooting
- Keeps the limit engaged even after closing the tray app
- Also automatically installs the battery command line tool. If you want a custom charging percentage, the CLI is the only way to do that.
Do you have questions, comments, or feature requests? Open an issue here or Tweet at me.
---
🖥 Command-line version
If you don't know what a "command line" is, ignore this section. You don't need it.
The GUI app uses a command line tool under the hood. Installing the GUI automatically installs the CLI as well. You can also separately install the CLI.
The CLI is used for managing the battery charging status for Apple Silicon Macbooks. Can be used to enable/disable the Macbook from charging the battery when plugged into power.
Installation
One-line installation:
bash
curl -s https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | bash
This will:
1. Compile the smc tool from the hholtmann/smcFanControl repository
2. Install smc to /usr/local/bin
3. Install battery to /usr/local/bin
Usage
Example usage:
shell
This will enable charging when your battery dips under 80, and disable it when it exceeds 80
battery maintain 80
After running a command like battery charging off you can verify the change visually by looking at the battery icon:
!Battery not charging
After running battery charging on you will see it change to this:
!Battery charging
For help, run battery without parameters:
Battery CLI utility v1.0.1
Usage:
battery status
output battery SMC status, % and time remaining
battery maintain LEVEL[1-100,stop]
reboot-persistent battery level maintenance: turn off charging above, and on below a certain value
eg: battery maintain