Skip to main content

BatteryTool

PyPI Python C23 License macOS

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

  1. Turn off "Optimized Battery Charging" in System Settings > Battery (Apple will fight you otherwise)
  2. Install Caffeine or something similar so your Mac doesn't fall asleep mid-cycle
  3. 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

Metadata

Release files for battery-tool 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for battery-tool 0.3.0
File Interpreter ABI Platform
battery_tool-0.3.0-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details

Release files / battery_tool-0.3.0-cp312-cp312-macosx_26_0_arm64.whl

Download URL battery_tool-0.3.0-cp312-cp312-macosx_26_0_arm64.whl
Size 41.1 kB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
e8214fdcba1312d4940cc460f2ba9a8e372202a0ecbf266fe466b8cc8a26678e
BLAKE2b-256 checksum
How to use checksums
d2e4726cff47cb4be1b4e66d24411c7f86aec210237c04e9de9fdfc297e39a9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Security for battery-tool 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for battery_tool-0.3.0-cp312-cp312-macosx_26_0_arm64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page