Get CPU & GPU temperatures and fan and battery statistics from your Mac.
This simple script will output a JSON array containing hardware statistics from your Mac.
- Install sensei.
brew install drpsychick/sensei/sensei - Install the
smcbinary.- Method 1:
- Copy the smc file to
/usr/local/binor your preferred location. You can specify the path with the--smc-pathargument. - Run
chmod +x /usr/local/bin/smc
- Copy the smc file to
- Method 2:
- Compile smc from the included source (original source here):
cd ./smc-command_src make make install
- Compile smc from the included source (original source here):
- Method 1:
./stats.py [-h] [--collection {all,temps} | --component {cpu,gpu,fans,battery} --fan {0,1}] [--smc-path SMC_PATH] [--sensei-path SENSEI_PATH]
| Argument | Description |
|---|---|
-h, --help |
Show help message. |
-l, --collection |
The collection to query. Defaults to all.Collections: - all: Query supported statistics.- temperatures: Query all supported temperature statistics. |
-c, --component |
The component to query. Components: - cpu: Query supported CPU statistics.- gpu: Query supported GPU statistics.- fans: Query supported fan statistics.- battery: Query supported battery statistics. |
-f, --fan |
Fan number to query. Can ONLY be used with '{--component,-c} fans' argument. Defaults to all. Fans: - 0: Left- 1: Right- all: Query all fans. |
Example: ./stats.py
Output: {"cpu": {"temperature": 76.9}, "gpu": {"temperature": 69.0}, "fans": [{"current_speed": 4437.0, "current_speed_pct": 60.4, "min_rpm": 2160, "max_rpm": 5927, "side": "left", "id": 0}, {"current_speed": 4079.0, "current_speed_pct": 59.5, "min_rpm": 2000, "max_rpm": 5489, "side": "right", "id": 1}]}