A command-line tool to monitor your battery health on macOS in a detrimental way
Project description
BatteryTool
BatteryTool cycles your battery on autopilot - discharge to 5%, charge to 95%, check health, repeat until you cross the 80% threshold. Leave it plugged in, go about your life, come back to a warranty-eligible battery. I wrote about the whole process here.
If you purchased an AppleCare Protection Plan for your Mac laptop and your battery retains less than 80 percent of its original capacity, Apple will replace the battery at no charge.
Only tested on Apple Silicon MacBooks running macOS 15, simply because I have no other way to test other Macs. VMs don't allow IOKit access to the real SMC hardware.
Before you start
- Turn off "Optimized Battery Charging" in System Settings > Battery (Apple will fight you otherwise)
- Install Caffeine or something similar so your Mac doesn't fall asleep mid-cycle
- Plug in your MacBook
Installation
uv tool install battery-tool
sudo battery-tool
Or for one-off usage:
sudo uvx battery-tool
Options
| Flag | What it does | Default |
|---|---|---|
--target-health |
Stop when health drops to this % | 79 |
--max-charge |
Charge up to this % before discharging | 95 |
--min-charge |
Discharge down to this % before charging | 5 |
--interval |
How often to check battery, in seconds | 60 |
--log-file |
Write logs to a file | None |
--status |
Print current battery stats and exit | False |
Acknowledgements
- battery.sh by Actually Mentor -- the battery management logic started here
- smc-command by hholtmann -- for talking to the SMC
- bclm -- for figuring out which SMC keys control charging
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file battery_tool-0.2.4-cp312-cp312-macosx_26_0_arm64.whl.
File metadata
- Download URL: battery_tool-0.2.4-cp312-cp312-macosx_26_0_arm64.whl
- Upload date:
- Size: 34.9 kB
- Tags: CPython 3.12, macOS 26.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6cd9081455e557db991df31c9b19a2c550125039ea68bcb98537fab49d9661c
|
|
| MD5 |
d4307bc836f1ea8fd677d4ec0e9ffe75
|
|
| BLAKE2b-256 |
0bc584fbef1147fd7b95f2e1764c8fd8835811b5effb303229d23d1397369e41
|
Provenance
The following attestation bundles were made for battery_tool-0.2.4-cp312-cp312-macosx_26_0_arm64.whl:
Publisher:
release.yaml on oresttokovenko/battery-tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
battery_tool-0.2.4-cp312-cp312-macosx_26_0_arm64.whl -
Subject digest:
c6cd9081455e557db991df31c9b19a2c550125039ea68bcb98537fab49d9661c - Sigstore transparency entry: 2148249863
- Sigstore integration time:
-
Permalink:
oresttokovenko/battery-tool@8a58d0ccc1f0df37fcdf2f5556c0dd7e2600bd48 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oresttokovenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8a58d0ccc1f0df37fcdf2f5556c0dd7e2600bd48 -
Trigger Event:
push
-
Statement type: