2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

macOSでバッテリー情報をコマンドラインで確認する方法

Posted at

はじめに

MacBookを長く使用していると、バッテリーの劣化状況が気になってきます。GUIのシステム情報からも確認できますが、コマンドラインから素早く確認できると便利です。

本記事では、macOSのコマンドラインを使ってバッテリーの充電回数、最大容量、健康状態などを調べる方法をご紹介します。

確認できる主な情報

  • 充電回数(Cycle Count): バッテリーの劣化度合いの指標
  • 最大充電容量: 現在のバッテリーが保持できる最大容量
  • 設計容量: 新品時の理論上の容量
  • 健康状態: バッテリーの健康度
  • 充電状態: 現在の充電レベル

方法1: system_profiler(推奨)

最も簡単で分かりやすい方法です。

基本的な使い方

# バッテリー情報のみを表示
system_profiler SPPowerDataType

主要な情報のみを抽出

# 充電回数、最大容量、状態のみを表示
system_profiler SPPowerDataType | grep -E "(Cycle Count|Maximum Capacity|Condition|Health)"

方法2: ioreg(詳細情報)

より詳細な低レベルの情報にアクセスできます。

基本的な使い方

# バッテリーの詳細情報
ioreg -rn AppleSmartBattery

主要な情報のみ抽出

# 主要な容量情報のみ
ioreg -rn AppleSmartBattery | grep -E "(CycleCount|MaxCapacity|DesignCapacity|CurrentCapacity)"

# 充電状態も含めて表示
ioreg -rn AppleSmartBattery | grep -E "(CycleCount|MaxCapacity|DesignCapacity|CurrentCapacity|IsCharging|ExternalConnected)"

ワンライナーでの情報取得

# 充電回数のみ
ioreg -rn AppleSmartBattery | grep CycleCount | awk '{print $3}'

# 最大容量のみ
ioreg -rn AppleSmartBattery | grep MaxCapacity | awk '{print $3}'

# バッテリー健康度の計算(最大容量/設計容量 × 100)
ioreg -rn AppleSmartBattery | awk '/MaxCapacity/{max=$3} /DesignCapacity/{design=$3} END{printf "%.1f%%\n", max/design*100}'

方法3: pmset(電源管理情報)

# バッテリー状態の概要
pmset -g batt

# 詳細な電源設定
pmset -g

実行例と結果の解釈

実際に system_profilerioreg を使用した例:

$ system_profiler SPPowerDataType | grep -E "(Cycle Count|Maximum Capacity|Condition|Health)"

      Health Information:
          Cycle Count: 99
          Condition: Normal
          Maximum Capacity: 90%

$ ioreg -rn AppleSmartBattery | awk '/MaxCapacity/{max=$3} /DesignCapacity/{design=$3} END{printf "%.1f%%\n", max/design*100}'

83.1%

結果の意味

  • Cycle Count: 99 - バッテリーの充電サイクル数(99回)
  • Condition: Normal - バッテリーの全体的な状態は正常
  • Maximum Capacity: 90% - macOSが表示するユーザー向けの容量
  • 83.1% - ハードウェアレベルでの実際の容量比率

2つの容量数値の違い

system_profilerの90%とioreg計算の83.1%は測定方法が異なります:

  • 90%: macOSが提供する分かりやすい表示
  • 83.1%: ハードウェアレベルでの実際の容量比率

バッテリー状態の判断基準

良好な状態

  • 充電回数: 500回未満
  • 容量: 80%以上
  • Condition: Normal

交換を検討

  • 充電回数: 1000回以上
  • 容量: 80%以下
  • Condition: Replace Soon, Replace Now

まとめ

macOSのコマンドラインを使用することで、バッテリーの詳細な情報を素早く確認できます。定期的にチェックして、適切なタイミングでのバッテリー交換を検討しましょう。

最初は system_profiler SPPowerDataType から始めることをお勧めします。より詳細な情報が必要な場合は ioreg を活用してください。

参考

2
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?