2
4

batteryでApple silicon MacBookの充電を80%で止める

Posted at

はじめに

MacBookのバッテリー寿命を伸ばすために,過充電は避けたいです.充電はバッテリー充電の最適化機能により普段使用しない時間帯には100%にならないように制御されます.けれども,どの時間帯でも充電が一定以上進まないようにしたいです.そこでbatteryを使って最大充電容量を制限します.

現在のバッテリー最大容量の確認

充電の制限とは関係ありませんが,以下の手順で現在のバッテリー最大容量を確認できます.

  1. 左上のリンゴマークをクリック
  2. 表示されたウィンドウ下部の詳細情報ボタンをクリック
  3. 設定ウィンドウが開くので一番下のシステムレポートボタンをクリック
  4. ハードウェア>電源(ネットワークの上)をクリック

battery のインストール

batteryのgithubリポジトリの指示に従ってインストールします.

インストール

CLI版は以下のコマンドでインストールできます.

curl -s https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | bash

以下のコマンドでGUI版をインストールできますが今回は使用しません.

brew install battery

インストールができたか確認

battery statusを実行してbatteryがインストールできたかを確認します.batteryを使うことで,上記の手順無しで現在のバッテリー最大容量が確認できます.

❯ battery status
07/08/24-10:27:18 - Battery at 77% (1:07 remaining), 12.549V, smc charging enabled
07/08/24-10:27:18 - Your battery is currently being maintained at 80%

最大充電容量の制限

battery maintain最大容量を制限できます.

battery maintain 最大容量

例えば,このようにして最大容量を80%に制限できます.

battery maintain 80

他のコマンド

使用方法確認

batteryを実行すると使用方法が表示されます.

❯ battery

Battery CLI utility v1.2.6

Usage:

  battery status
    output battery SMC status, % and time remaining

  battery logs LINES[integer, optional]
    output logs of the battery CLI and GUI
        eg: battery logs 100

  battery maintain PERCENTAGE[1-100,stop]
    reboot-persistent battery level maintenance: turn off charging above, and on below a certain value
        it has the option of a --force-discharge flag that discharges even when plugged in (this does NOT work well with clamshell mode)
    eg: battery maintain 80
    eg: battery maintain stop

  battery maintain VOLTAGE[10.5V-12.6V,stop] (HYSTERESIS[0.1V-2V])
    reboot-persistent battery level maintenance: keep battery at a certain voltage
  default hysteresis: 0.1V
    eg: battery maintain 11.4V       # keeps battery between 11.3V and 11.5V
    eg: battery maintain 11.4V 0.3V  # keeps battery between 11.1V and 11.7V

  battery charging SETTING[on/off]
    manually set the battery to (not) charge
    eg: battery charging on

  battery adapter SETTING[on/off]
    manually set the adapter to (not) charge even when plugged in
    eg: battery adapter off

  battery calibrate
    calibrate the battery by discharging it to 15%, then recharging it to 100%, and keeping it there for 1 hour

  battery charge LEVEL[1-100]
    charge the battery to a certain percentage, and disable charging when that percentage is reached
    eg: battery charge 90

  battery discharge LEVEL[1-100]
    block power input from the adapter until battery falls to this level
    eg: battery discharge 90

  battery visudo
    ensure you don't need to call battery with sudo
    This is already used in the setup script, so you should't need it.

  battery update
    update the battery utility to the latest version

  battery reinstall
    reinstall the battery utility to the latest version (reruns the installation script)

  battery uninstall
    enable charging, remove the smc tool, and the battery script

よく使うコマンド

battery status

現在のバッテリー状態を表示します.

battery maintain

先述の通りです.以下のようにしてバッテリーの最大容量を指定します.

battery maintain 最大容量

battery charging onbattery charging off

バッテリーを充電するかしないかを手動で設定します.

battery update

batteryを最新バージョンにアップデートします.

battery reinstall

batteryを再インストールします.

battery uninstall

batteryをアンインストールします

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4