44

I leave my MacBook plugged in for days at a time, so the battery stays charged to 100%. Despite Apple claims to the contrary*, I believe that the battery's capacity would be better preserved if I could keep it at an 80% state-of-charge. Is there any command or setting that would let me disable charging from the power adapter?

Here are various options, (1) being my most preferred:

  1. A setting to automatically maintain battery at 80% SoC (like my Tesla has)
  2. A setting/command to use the AC adapter for running power only ("not charging" state)
  3. A command to tell my Mac to totally ignore the AC adapter power

(2) could be cobbled into (1) with some kind of script. Even if not possible from the Mac itself, (3) could be cobbled together with an IOT switch. But with (3), it's unclear the lower maintained SoC would outweigh the cost of the additional cycling.

* As of 11 Feb 2022, I can no longer find Apple claims that it's best to fully charge the battery.

1

4 Answers 4

24

Use bclm (Intel MacBook only?).

Follow the instructions on github:

1. Download signed and notarized binary from [releases][2].
# Alternatively, you can also get it from homebrew or compile it manually. Read github readme for more details.

2. Extract battery tool
$ unzip bclm.zip
$ sudo cp bclm /usr/local/bin

# 3. Set battery limit
$ sudo blcm write 80

# 4. Verify battery limit
$ blcm read

# 5. Reset the limit when needed
$ sudo blcm write 100

Notes:

  • It might be better if you set it even lower, for example, 60% or 70%. Then, before you need to use it on battery for a long time, sudo python3 main.py -r. You can automate this switching between 80% and full using ]launchd (read man launchd.plist).
  • macOS show charge approximately 3-5% greater than the real value, so it may feel like the tool is not working initially. Use coconutbattery (GUI) or ioreg -l | awk '$3~/Capacity/{c[$3]=$5}END{OFMT="%.3f";max=c["\"MaxCapacity\""];print(max>0?100*c["\"CurrentCapacity\""]/max:"?")}' to calculate real battery capacity.
  • If you are using macOS Catalina, you need to turn off the "Optimised battery charging" function for the tool to work properly.
  • There is also a GUI version: https://github.com/godly-devotion/charge-limiter. Both work by setting the BCLM key in SMC to a custom value.

For Apple Silicon Macs and macOS 11 (Big Sur) and higher, use AlDente.

5
  • If I understand the process you've described, it would seem that Homebrew isn't actually required - is it? Have you tried this yourself? Anyway - good answer I think - I've searched for something like this, but hadn't had any luck.
    – Seamus
    Nov 21, 2020 at 4:45
  • Why not just download python3 from python.org/downloads as they do have a macOS 64-bit installer! Nov 21, 2020 at 10:43
  • +1 to GUI Version, no fuss, no weird steps
    – WurmD
    Sep 6, 2021 at 10:42
  • 2
    Maybe I should change osx_battery_charge_limit to github.com/zackelia/bclm as the latter have no dependencies and have notarized and signed binary releases?
    – Joy Jin
    Dec 2, 2021 at 13:42
  • Implementation detail: the BCLM key doesn't seem to exist on Apple Silicon, just something that turns charging on/off. So scripts + AlDente basically poll for the battery level, and then disable charging after a certain point. Feb 19 at 16:51
17

macOS 10.15.5 on a Mac notebook with Thunderbolt 3 ports has this option (even a bit smarter) embedded, see Optimised battery charging.

https://support.apple.com/kb/HT211094

System Preferences: Battery

2
  • 27
    Unfortunately, "even a bit smarter" is failing for me. The OS has yet to figure out when to stop at 80%, and I doubt it ever will (my routines are unpredictable) Jan 7, 2021 at 12:14
  • 6
    Indeed. Not very smart at all :) I would much prefer to have a manual setting, instead of having to rely on hacks like given earlier. Nov 9, 2021 at 14:09
4

You can try AlDente (there is also a Pro Version):

  • Charge Limiter allows you to set your maximum charging percentage between 20 and 100 percent. You can either set it by using the slide bar or by typing in the desired percentage in the field above and pressing enter afterwards.
  • Discharge - This feature allows your MacBook to run completely on Battery even if it is plugged in. Therefore, you can actively discharge your MacBook to a more healthy percentage. Unfortunately, while Discharge is activated, clamshell mode is not supported due to technical limitations.
0
0

Tried below and it worked. Thanks so much. I only used step 1 and 4. set limit to 70 and it does stop charging until 72%!!

Open the terminal and follow the steps by typing the commands in the terminal

1. Install command-line tools

xcode-select --install

4. Download battery tool
Grab project for "Intel only Macbook (OSX) limit maximum battery charge"

git clone --recursive https://github.com/DevNulPavel/osx_battery_charge_limit

cd osx_battery_charge_limit

sudo python3 main.py -s 80
1
  • 4
    This seems to refer to another answer which makes it hard to understand. Can you please make it stand on its own (and also fix the formatting)?
    – nohillside
    Nov 19, 2021 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .