Controlling MacBook Pro Charging Cap with Alfred

UPDATE 10/17/22: I recently updated my 2018MBP to 12.6 Monterey and this technique seems not to work anymore. I haven’t had a chance to look into fixing it. For now, this other app works: https://github.com/godly-devotion/charge-limiter

If you just came here looking for my Alfred workflow, you can download it here.

Why?

As lithium-ion batteries get more common, bigger, and more difficult to replace, end users are getting more aware of how to keep them healthy. In particular, Tesla’s decision to trust the user with battery maintenance has made a few concepts more common knowledge, at least among owners. They say:

  • Don’t supercharge unless you have to, as fast charging causes wear
  • Avoid charging all the way to 100% if you don’t need to, since this also causes wear
  • Avoid discharging all the way to 0% before recharging, although this matters less.

As it happens, these same rules of thumb apply to any li-ion battery. Ever wondered why your cell phone 2 years in dies by like 10am? Your laptop does a bit better, probably only making you scratch your head about battery life by maybe year 3. But then how is a car’s pack supposed to last 8 years?!

The answer is that in the case of the car, packs are often deliberately overbuilt by a certain percentage, so that a “100% charge” is actually only 80% or 90%. Since the worst of the wear occurs at the extremes of the charge range and there’s much less wear in the middle, that little bit of overhead can get you years of service. On the other hand, cell phones have two prevailing design goals: 1) last all day in the SMALLEST and LIGHTEST package possible, and 2) ensure that the user gets JUUUSSST annoyed enough to replace it after two years at the most.

Although, there’s one other aspect of battery care and feeding that impacts consumer electronics, but not so much cars:

  • Floating a li-ion battery at full charge continuously ALSO represents a heavy wear load.

I bet you probably leave your laptop plugged in at your desk hours a day, yeah? And if you’re normal, you probably charge your phone overnight – which might charge to 100% in about 90 minutes, then sit on charge at 100% for the next 6 to 8 hours. And even worse, you probably pugged it in to a fast charger, designed to get you out the door quick when your phone’s almost dead, and to efficiently kill its battery within that 2 year timeframe so you buy a new one.

OK, so How?

In a perfect world, you could protect your device batteries by

  1. charging them only as fast as you absolutely must
  2. limiting the peak charge to somewhere less than 100%, maybe ~70%
  3. avoiding complete discharge to zero.

Of course, you’ll probably need the device’s full cooperation to manage this. It’s too much to ask to handle desk work AND constantly plugging/unplugging your laptop to keep it in the sweet spot, and since that still cycles your battery anyway constantly charging and discharging, it’s not even ideal.

In fact, SOME machines do offer tools for this: the Surface Pro series has Kiosk mode that you can enable in EFI to charge the battery to 50% and keep it there for store displays constantly plugged in to shore power. But that’s mostly just to keep the battery from wearing out and bulging in that scenario – it’s impractical for a user. Lenovo, to their credit, provides a toggle for some of their business machines that can set a charging cap of 70% in scenarios you know you don’t need the battery life, like at your desk all day.

Unfortunately, those are limited and incomplete options.

Best Tools, Right Now

I’ve got an iPhone and a MacBook Pro that I use right now. For the iPhone, there’s really only one trick you can do: you can’t limit the charging peak (yet), but you can at least limit the charging RATE, which is helpful. Instead of using a fast charger, use a slow one. The 5V/1A charger that comes with the iPhone is a good option, even though it’s slow. If you can find a 5V 500mA charger to use on your nightstand, that might be even better. If not, a Qi pad plugged into a 5V charger will be pretty limited in what hits the phone. DO NOT use a fast charger, or a Qi pad plugged into i.e. a QuickCharge adapter, unless you really must. Maybe leave a SLOW charger on the nightstand, and a fast Qi pad in the kitchen or by the door for when you need to top up fast before you leave the house.

For the MacBook Pro, there are more options. I’ve got a newer 15″ USB-C, which comes with the 87W charger. The 87W brick is necessary for this machine since it can provide enough power to run the laptop full tilt and charge the battery at the same time. On the other hand, you don’t HAVE to use this brick. The USB-C Mac can charge from ANY USB-C adapter, and the only problem is that it might charge slow or even still discharge under heavy load. By default, I use this surprisingly excellent quality 61W USB-C GaN charger unless I know I’ll need the full 87W. But you could even go lower if you’re just reading some word docs – 18W and 30W USB-C chargers are common, and those will work too. In fact, you can even charge from a 5V 2.4A cell phone charger with a USB-A to C cable, but the ~12W you get from that will have your battery discharging while plugged in unless your workload is light and screen brightness is minimum, or the machine’s asleep.

As far as charge limiting, Apple themselves have released a new checkbox you can tick in 10.15.5 called Battery Health Management. The approach isn’t very hands-on, and you have to just hope their black-box “intelligence” actually does save your battery health, but it’s probably a great option for most people.

If you do want a little extra control, a couple projects finally came to my attention: despite years of failing to find any such option to limit peak battery charge, it turns out there IS a register in the SMC (System Management Controller) that limits battery max charge. If you’re already on Catalina, you can try an app called Al Dente, or another called Battery Status Show, either of which will let you set the maximum battery charge between 40 and 100%.

If those don’t suit your fancy, or if you haven’t upgraded yet, I made a little wrapper around the core SMC utility they use in the form of an Alfred workflow that lets you check your current setting, or set the limit to 70 or 100%.

Screenshot of alfred workflow in operation

You can download the workflow here Updated: 70/80/90/100% options: Download. Since this workflow operates by poking values in the SMC, it frankly feels a little dangerous and there’s not much in the way of error checking – I don’t know how it might go wrong, s oI don’t have checks to make sure it doesn’t. That said, I tested it on my own MBP2018 and it works great. Between my test and the other two projects, I think the following list of machines should work, and probably others (almost certainly anything in between):

  • 2019 MacBook Pro 16″
  • 2018 MacBook Pro 15″
  • 2017 MacBook Pro 13″ without TouchBar
  • 2017 MacBook Air 13″
  • 2013 MacBook Pro 13″
Graph of battery charge showing plateau at 72%.
At Last!

19 Comments

  1. Fred Hall
    May 28, 2020

    I went to the link to download your Alfred wrapper – but couldn’t find any link to the download.

  2. May 28, 2020

    @Fred you’re right – it’s buried down under the first screenshot. Added a much more obvious link up top.

  3. May 28, 2020

    Oh, no, I get it now – the link was BROKEN. Fixed, sorry!

  4. Hans
    June 22, 2020

    The workflow doesn’t seem to work on my Early 2015 13 inch MBP on Sierra. Do I need to do anything else than invoking the workflow?

  5. June 22, 2020

    @Hans Honestly I’m not sure. It SHOUD work, but I don’t know that it will. You could try digging in to some of those other tools. In particular, download the underlying binary I used per this disucssion and try that. You’ll have to be quite familiar with Terminal, though: https://github.com/davidwernhart/AlDente/issues/7.
    If you encounter obvious errors using that binary, that’ll be good info to figure out what’s going on.

  6. Limeybastid
    September 28, 2020

    What a great article. Many thanks.

  7. henry
    November 6, 2020

    tested working on a 13″ 2020 macbook 2thunderbolt port!

  8. henry
    November 6, 2020

    tested on a 13″ 2020 macbook 2thunderbolt port!

  9. John
    November 30, 2020

    Hi, i’m just wondering if I can tweak the battery percentage limiter from 70% to 50%. How can I do that? Thanks!

  10. November 30, 2020

    @John Open Alfred preferences, click “workflows,” select “MBPCharge,” and double click the “Charge” list filter. Click the “+” to add an item, title it like the others, and set “arg” to 32. 50 decimal is 0x32 hex.

  11. Ruben
    December 18, 2020

    Such a neat program! Been using it in conjunction with Alfred and I seriously believe you have saved me tons of charging cycles over the past two months. I was looking for a program to do this, but the ones I tried did not function properly. This one works perfectly, and the integration with Alfred is perfect. Working 12-14 hours everyday on my thesis, my battery would definitely have taken a significantly larger hit if I were to top it off at 100% vs. 70% with your app.

  12. Quintin Fettes
    February 22, 2021

    Has anyone tried this on an m1 macbook pro?

  13. Peter376
    May 25, 2021

    Hello all, I tried Al Dente on my Late 2103 MBP 15″ retina, no dice. It installs fine but charges beyond the limit. I would like to try your script in Alfred, but I found that I need to purchase the powerpack first in order to run workflows. If it should fail it’s a waste of money.
    So my question is: has anyone tried this on a 2013 MBP 15″?

    Much appreciated.
    Kind regards,
    Peter

Leave a Reply

Your email address will not be published. Required fields are marked *