랭킹으로 돌아가기

zackelia/bclm

Swift

macOS command-line utility to limit max battery charge

macosbatterybattery-lifebattery-healthsmc
스타 성장
스타
2.2k
포크
101
주간 성장
이슈
7
1k2k
2023년 1월2024년 3월2025년 5월2026년 7월
README

BCLM

[!WARNING] BCLM does not work on macOS >= 15.0 due to new entitlement enforcement from the kernel that cannot be circumvented without disabling SIP. See discussion: https://github.com/zackelia/bclm/issues/49

BCLM is a wrapper to read and write battery charge level max (BCLM)/CHWA values to the System Management Controller (SMC) on Mac computers. It supports both Intel and Apple silicon. This project was inspired by several battery management solutions, including Apple's own battery health management.

The purpose of limiting the battery's max charge is to prolong battery health and to prevent damage to the battery. Various sources show that the optimal charge range for operation of lithium-ion batteries is between 40% and 80%, commonly referred to as the 40-80 rule [1][2][3]. This project is especially helpful to people who leave their Macs on the charger all day, every day.

Installation

The easiest method to install BCLM is through brew.

BCLM is written in Swift and is also trivial to compile. Currently, it can only be compiled on macOS Catalina (10.15) or higher but it can run on OS X Mavericks (10.9) or higher.

A release zip is also provided with a signed and notarized binary for those who do not have development tools or are on an older macOS version.

Brew

$ brew tap zackelia/formulae
$ brew install bclm

From Source

$ make build
$ make test
$ sudo make install

From Releases

$ unzip bclm.zip
$ sudo mkdir -p /usr/local/bin
$ sudo cp bclm /usr/local/bin

Note: For older versions of macOS, it may be necessary to install the Swift 5 Runtime Support for Command Line Tools if you get the following error: dyld: Symbol not found

Usage

$ bclm
OVERVIEW: Battery Charge Level Max (BCLM) Utility.

USAGE: bclm <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  read                    Reads the BCLM value.
  write                   Writes a BCLM value.
  persist                 Persists bclm.
  unpersist               Unpersists bclm.

  See 'bclm help <subcommand>' for detailed help.

For Intel machines, when writing values, macOS charges slightly beyond the set value (~3%). In order to display 80% when fully charged, it is recommended to set the BCLM value to 77%. When charging while system is shut down or sleeping, the charging can go beyond set value more than average 3%.

$ sudo bclm write 77
$ bclm read
77

For Apple silicon machines, only the values 80 and 100 are supported and firmware >= 13.0 is required.

Note that in order to write values, the program must be run as root. This is not required for reading values.

Persistence

The SMC can be reset by a startup shortcut or various other technical reasons. To ensure that the BCLM is always at its intended value, it should be persisted.

This will create a new plist in /Library/LaunchDaemons and load it via launchctl. It will persist with the current BCLM value and will update on subsequent BCLM writes.

$ sudo bclm persist

Likewise, it can be unpersisted which will unload the service and remove the plist.

$ sudo bclm unpersist
관련 저장소
flutter/flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

DartBSD 3-Clause "New" or "Revised" Licensemobileandroid
flutter.dev
177.9k30.7k
jlevy/the-art-of-command-line

Master the command line, in one page

bashunix
161.9k14.8k
rustdesk/rustdesk

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Rustcrates.ioGNU Affero General Public License v3.0remote-controlremote-desktop
rustdesk.com
118.6k18.1k
nodejs/node

Node.js JavaScript runtime ✨🐢🚀✨

JavaScriptnpmOthernodejsjavascript
nodejs.org
118.4k36.2k
jaywcjlove/awesome-mac

 This project is dedicated to collecting high-quality macOS software and organizing them systematically by different categories for easy search and use.

SwiftCreative Commons Zero v1.0 Universalmacossoftware
git.io/macx
108.4k8.2k
alacritty/alacritty

A cross-platform, OpenGL terminal emulator.

Rustcrates.ioApache License 2.0terminal-emulatorsopengl
alacritty.org
65k3.5k
warpdotdev/warp

Warp is an agentic development environment, born out of the terminal.

Rustcrates.ioGNU Affero General Public License v3.0rustlinux
warp.dev
63.5k5.3k
tldr-pages/tldr

Collaborative cheatsheets for console commands 📚.

MarkdownOthershellman-page
tldr.sh
63.2k5.3k
atom/atom

:atom: The hackable text editor

JavaScriptnpmMIT Licenseatomeditor
atom.io
60.8k17.2k
tw93/Pake

🤱🏻 Turn any webpage into a desktop app with one command.

Rustcrates.ioGNU General Public License v3.0rusttauri
60.1k12.2k
tw93/Mole

🐹 Clean, uninstall, analyze, optimize, and monitor your Mac from the terminal.

ShellGNU General Public License v3.0cleancleaner
mole.fit
59.5k2.1k
FiloSottile/mkcert

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

GoGo ModulesBSD 3-Clause "New" or "Revised" Licensehttpstls
mkcert.dev
59.4k3.1k