If your MacBook lives on a charger, it's aging faster than it needs to. Fix it in 10 minutes with a free tool, a charge limit, and a one-tap toggle for when you go mobile.
Lithium-ion batteries wear out faster when they stay at a high charge level. A MacBook sitting at 100% all day, every day, is degrading its battery for no reason. You're not even using that charge — the Mac is running off wall power the whole time.
By capping the charge at 70–80%, your Mac runs off the power adapter like a desktop while the battery sits idle in a healthy range. Think of it like a built-in UPS: the battery is there when you need it, but it's not being stressed when you don't.
The difference is real. Batteries kept at lower charge levels last significantly longer — sometimes years longer before you notice capacity loss.
Never used Terminal before? Terminal is an app already on your Mac that lets you type commands directly. You'll find it in Applications → Utilities → Terminal. Everything you need to type is written out below — just copy and paste.
Homebrew is a free tool that makes it easy to install software on your Mac. You might already have it. Let's check — paste this into Terminal:
brew --version
If you see a version number (like Homebrew 4.x.x), you're good — skip to Step 2.
If you see "command not found," install Homebrew by pasting this:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After it finishes: Homebrew will display a few lines telling you to run commands to add it to your PATH. Follow those instructions, then close and reopen Terminal before continuing.
batt is a free, open-source tool that controls your MacBook's charging. It's lightweight, has no ads or telemetry, and runs quietly in the background. Over 1,500 people use it on GitHub.
Install it:
brew install batt
Then start the background service that keeps it running (including after restarts):
sudo brew services start batt
It will ask for your password. This is your Mac login password. When you type it, nothing will appear on screen — that's normal. Just type it and press Enter.
What success looks like: You should see a message like ==> Successfully started batt.
Now tell batt to cap your battery. The most common choices are 70% or 80%:
Pick one and paste the command. Here's 70%:
batt limit 70
Or for 80%:
batt limit 80
Verify it's working:
batt status
What success looks like: You'll see output including Upper limit: 70% (or whatever you chose). Your Mac will stop charging once it reaches that level.
Apple has its own battery management feature that conflicts with batt. You need to turn it off so the two don't fight each other.
Don't skip this. If you leave Apple's feature on, it may override your charge limit and charge to 100% unpredictably.
This creates a small script on your Mac that flips between your desk limit and 100%. You'll use it whenever you need to go mobile (or come back).
If you chose 70% as your limit, paste this entire block:
mkdir -p ~/bin && cat > ~/bin/toggle-battery-limit.sh << 'SCRIPT'
#!/bin/zsh
CURRENT=$(/opt/homebrew/bin/batt status 2>&1)
if echo "$CURRENT" | grep -q "Upper limit: 70%"; then
/opt/homebrew/bin/batt limit 100 2>&1
osascript -e 'display notification "Charging to 100% — Mobile Mode" with title "🔋 Battery"'
else
/opt/homebrew/bin/batt limit 70 2>&1
osascript -e 'display notification "Capped at 70% — Desk Mode" with title "🔋 Battery"'
fi
SCRIPT
chmod +x ~/bin/toggle-battery-limit.sh
If you chose 80%, paste this version instead:
mkdir -p ~/bin && cat > ~/bin/toggle-battery-limit.sh << 'SCRIPT'
#!/bin/zsh
CURRENT=$(/opt/homebrew/bin/batt status 2>&1)
if echo "$CURRENT" | grep -q "Upper limit: 80%"; then
/opt/homebrew/bin/batt limit 100 2>&1
osascript -e 'display notification "Charging to 100% — Mobile Mode" with title "🔋 Battery"'
else
/opt/homebrew/bin/batt limit 80 2>&1
osascript -e 'display notification "Capped at 80% — Desk Mode" with title "🔋 Battery"'
fi
SCRIPT
chmod +x ~/bin/toggle-battery-limit.sh
What success looks like: No output means it worked. The script is saved and ready to use.
Now let's make it so you can toggle with a single tap from your menu bar — no Terminal needed day-to-day.
First, find your username. Paste this in Terminal and note the result:
whoami
Now open the Shortcuts app (search for it in Spotlight with Cmd + Space) and follow these steps:
/Users/USERNAME/bin/toggle-battery-limit.shwhoami above.What success looks like: You now have a "Toggle Battery Limit" shortcut in your menu bar. Click the Shortcuts icon in the menu bar and you'll see it listed.
For even quicker access, you can add your shortcut to Control Center:
Now you can toggle your battery limit from Control Center with a single tap.
Most days, you do absolutely nothing. Your Mac charges to your limit and stays there, running off wall power like a desktop.
When you need to go mobile:
That's it. The batt service survives restarts — it remembers your last limit and the daemon starts automatically on boot. Sleep is handled too: batt disables charging before your Mac sleeps to prevent overnight charge-ups.
No. You're not modifying hardware or bypassing security protections. batt communicates with the SMC (System Management Controller) the same way Apple's own tools do. You can uninstall it completely in under a minute.
Yes. It's open source with over 1,500 stars on GitHub, meaning its code is public and auditable. It collects no data, has no telemetry, requires no internet connection, and runs entirely on your Mac.
70% is better for long-term battery health. 80% gives you more charge when you unplug. Both are significantly better than leaving it at 100%. If your Mac rarely leaves your desk, go with 70%. If you unplug a few times a week, 80% gives you more buffer.
Anytime. Just open Terminal and run batt limit XX with your new number. If you made a toggle script, you'll also want to update the number inside it.
When fully shut down, batt isn't running, so the Mac charges normally up to 100%. This is a hardware limitation — the SMC handles charging during shutdown independently. This is fine for occasional shutdowns; just plug in after booting back up and it will hold at your limit.
Handled. batt disables charging before sleep to prevent your Mac from quietly charging to 100% overnight. When it wakes, the limit is re-applied automatically.
No. batt only works on Apple Silicon Macs (M1, M2, M3, M4). Intel Macs use a different SMC interface that batt doesn't support.
Three commands in Terminal and you're done:
sudo brew services stop batt
brew uninstall batt
rm ~/bin/toggle-battery-limit.sh
Then go to System Settings → Battery → Battery Health and turn Optimized Battery Charging back on. Delete the Shortcut you created if you made one.
Your Mac's hibernatemode should be set to 3 (the factory default for MacBooks). If you've changed it at some point, batt's sleep charging protection might not work correctly. You can check with pmset -g | grep hibernatemode in Terminal. If it shows anything other than 3, run sudo pmset -a hibernatemode 3 to reset it.
batt is actively maintained and updates occasionally add new macOS compatibility. To update, just run brew upgrade batt in Terminal every once in a while.