clearing "permanent" battery failure

After an hour at -20 °C, my MacBook7,1 refused to charge and would shut off instantly when unplugged. The hardware was fine, but some parameter (likely cell voltage imbalance) temporarily crossed a failure threshold, and the chip disabled itself.


I'm far from the first to do this, and I relied heavily on the following links.


This ugly-ish Objective-C program should clear the PF status from macOS userspace. You'll need this header file to build it.


It took a couple tries and/or a reboot to take effect, but the laptop accepts a charge and runs on battery again!