• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

zackelia/bclm: macOS command-line utility to limit max battery charge

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

zackelia/bclm

开源软件地址(OpenSource Url):

https://github.com/zackelia/bclm

开源编程语言(OpenSource Language):

Swift 99.3%

开源软件介绍(OpenSource Introduction):

BCLM

BCLM is a wrapper to read and write battery charge level max (BCLM) values to the System Management Controller (SMC) on Mac computers. 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

$ swift build
$ sudo swift test
$ cp .build/debug/bclm /usr/local/bin

From Releases

$ unzip bclm.zip
$ cp bclm /usr/local/bin

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.

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%.

$ sudo bclm write 77
$ bclm read
77

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 plist.

$ sudo bclm unpersist



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap