Free · 10 minutes · Apple Silicon Macs

Your MacBook battery is dying while it sits on your desk.

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.

At desk: holds at 70%
Tap toggle
Charges to 100%
Go mobile
Back at desk: tap toggle
Holds at 70% again

Why This Matters

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.

What You'll Need

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.

Step-by-Step Setup

1

Install Homebrew

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.

2

Install batt

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.

3

Set your charge limit

Now tell batt to cap your battery. The most common choices are 70% or 80%:

  • 70% — Best for longevity. Great if your Mac rarely leaves the desk.
  • 80% — Good balance between longevity and having more charge when you unplug.

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.

4

Disable Apple's Optimized Battery Charging

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.

5

Create the toggle script

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.

6

Create a macOS Shortcut for one-tap toggling

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:

  1. Click "Menu Bar" in the left sidebar. Creating a shortcut here automatically pins it to your menu bar.
  2. Click the + button to create a new shortcut.
  3. In the search panel on the right, search for "Run Shell Script" and add it.
  4. Set the Shell to zsh.
  5. In the script body, type: /Users/USERNAME/bin/toggle-battery-limit.sh
    Replace USERNAME with the result from whoami above.
  6. Make sure "Run as Administrator" is unchecked.
  7. Rename the shortcut to "Toggle Battery Limit" (click the name at the top).

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.

7

Add to Control Center (optional)

For even quicker access, you can add your shortcut to Control Center:

  1. Open Control Center (click the icon in your menu bar).
  2. Click the + at the bottom left.
  3. Find and add Shortcuts.
  4. Select "Toggle Battery Limit".

Now you can toggle your battery limit from Control Center with a single tap.

Day-to-Day Usage

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:

  1. Tap the toggle from your menu bar or Control Center. You'll get a notification: "Charging to 100% — Mobile Mode."
  2. Wait for it to charge, then unplug and go.
  3. When you're back at your desk, plug in and tap the toggle again. You'll get: "Capped at 70% — Desk Mode."

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.

Frequently Asked Questions

Will this void my warranty?

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.

Is batt safe?

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.

Should I pick 70% or 80%?

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.

Can I change the limit later?

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.

What happens when my Mac is shut down?

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.

What about sleep or closing the lid?

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.

Does this work on Intel Macs?

No. batt only works on Apple Silicon Macs (M1, M2, M3, M4). Intel Macs use a different SMC interface that batt doesn't support.

How do I uninstall everything?

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.

What about hibernatemode?

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.

Keep batt updated

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.