Reading CPU temperature and Fan speeds from the command line in macOs 10.14 Mojave
Posted on Fri 27 September 2019 in macOs
I was looking to read out the current temperature and fan speed of my MacBook Pro running macOS 10.14 Mojave. I prefered build-in tools over shady apps. After some searching, I found the powermetrics
tool (which needs sudo
privileges). By default, it outputs lots of details every 5 seconds:
Machine model: MacBookPro15,1
SMC version: Unknown
EFI version: 220.99.0
OS version: 18G103
Boot arguments:
Boot time: Fri Sep 27 13:23:38 2019
*** Sampled system activity (Fri Sep 27 14:05:02 2019 +0200) (5015.24ms elapsed) ***
*** Running tasks ***
Name ID CPU ms/s User% Deadlines (<2 ms, 2-5 ms) Wakeups (Intr, Pkg idle)
kernel_task 0 28.82 0.00 0.00 0.00 673.63 212.91
WindowServer 183 67.37 61.86 29.70 10.57 46.45 15.35
CalendarAgent 321 32.20 82.65 0.00 0.00 0.20 0.20
[...]
ALL_TASKS -2 766.12 80.97 101.09 14.16 1125.97 384.23
**** Battery and backlight usage ****
Backlight level: 791 (range 0-1024)
Keyboard Backlight level: 0 (off 0 on range 32-512)
**** Network activity ****
out: 30.71 packets/s, 11892.96 bytes/s
in: 31.30 packets/s, 18962.61 bytes/s
**** Disk activity ****
read: 1.00 ops/s 4.08 KBytes/s
write: 7.58 ops/s 78.40 KBytes/s
**** Interrupt distribution ****
CPU 0:
Vector 0x46(SMC): 12.96 interrupts/sec
Vector 0x72(IGPU): 17.95 interrupts/sec
Vector 0x74(GFX0): 418.52 interrupts/sec
Vector 0x75(HDAU): 3.79 interrupts/sec
Vector 0x76(XHC1): 143.36 interrupts/sec
Vector 0x79(ANS2): 6.58 interrupts/sec
Vector 0x86(ARPT): 7.58 interrupts/sec
Vector 0x8c(IOBC): 0.80 interrupts/sec
Vector 0xdd(TMR): 195.40 interrupts/sec
Vector 0xde(IPI): 112.86 interrupts/sec
Vector 0xdf(PMI): 0.20 interrupts/sec
CPU 1:
Vector 0xdd(TMR): 1.20 interrupts/sec
Vector 0xde(IPI): 35.09 interrupts/sec
[...]
CPU 15:
Vector 0xdd(TMR): 0.60 interrupts/sec
Vector 0xde(IPI): 4.39 interrupts/sec
**** Processor usage ****
Intel energy model derived package power (CPUs+GT+SA): 9.62W
LLC flushed residency: 44.5%
System Average frequency as fraction of nominal: 118.43% (2723.96 Mhz)
Package 0 C-state residency: 47.56% (C2: 47.56% C3: 0.00% C6: 0.00% C7: 0.00% C8: 0.00% C9: 0.00% C10: 0.00% )
Performance Limited Due to:
CPU LIMIT TURBO_ATTENUATION
CPU LIMIT SPARE_IA_14
CPU/GPU Overlap: 1.38%
Cores Active: 49.10%
GPU Active: 1.51%
Avg Num of Cores Active: 0.83
Core 0 C-state residency: 74.42% (C3: 3.57% C6: 0.00% C7: 70.85% )
CPU 0 duty cycles/s: active/idle [< 16 us: 618.91/176.66] [< 32 us: 148.35/20.34] [< 64 us: 119.44/226.11] [< 128 us: 138.18/270.18] [< 256 us: 155.53/166.69] [< 512 us: 67.20/161.31] [< 1024 us: 40.08/87.73] [< 2048 us: 21.33/90.32] [< 4096 us: 5.78/65.40] [< 8192 us: 1.00/51.24] [< 16384 us: 1.00/1.20] [< 32768 us: 0.20/0.00]
CPU Average frequency as fraction of nominal: 103.26% (2375.02 Mhz)
[...]
CPU 15 duty cycles/s: active/idle [< 16 us: 57.82/4.98] [< 32 us: 0.40/4.39] [< 64 us: 0.60/5.58] [< 128 us: 0.20/5.58] [< 256 us: 0.60/5.98] [< 512 us: 0.20/6.18] [< 1024 us: 0.20/5.78] [< 2048 us: 0.20/1.99] [< 4096 us: 0.40/2.19] [< 8192 us: 0.00/4.59] [< 16384 us: 0.00/3.79] [< 32768 us: 0.00/2.79]
CPU Average frequency as fraction of nominal: 113.15% (2602.45 Mhz)
**** GPU usage ****
GPU 0 name IntelIG
GPU 0 C-state residency: 98.66% (0.08%, 98.58%)
GPU 0 P-state residency: 1200MHz: 0.00%, 1150MHz: 0.00%, 1100MHz: 0.00%, 1050MHz: 0.00%, 1000MHz: 0.00%, 950MHz: 0.00%, 900MHz: 0.00%, 850MHz: 0.00%, 800MHz: 0.00%, 750MHz: 0.00%, 700MHz: 0.00%, 650MHz: 0.00%, 600MHz: 0.00%, 550MHz: 0.00%, 500MHz: 0.00%, 450MHz: 0.00%, 400MHz: 0.00%, 350MHz: 0.62%
GPU 0 average active frequency as fraction of nominal (350.00Mhz): 100.00% (350.00Mhz)
GPU 0 HW average active frequency : 0.00
GPU 0 GPU Busy : 1.34%
GPU 0 DC6 Residency : 0.00%
GPU 0 [PSR] GPU + TCON are Off : 0.00%
GPU 0 [PSR] Only GPU is On : 100.00%
GPU 0 [PSR] Only TCON is On : 0.00%
GPU 0 [PSR] GPU + TCON are On : 0.00%
GPU 0 [PSR] StateMachine Bypass : 100.00%
GPU 0 [PSR] StateMachine FIFO : 0.00%
GPU 0 [PSR] StateMachine Others : 0.00%
GPU 0 DPB Strong On : 0.00%
GPU 0 DPB Weak On : 0.00%
GPU 0 PPFM on : 0.00%
GPU 0 Throttle High Priority(%): 0
GPU 0 Throttle NormalHi Priority(%): 0
GPU 0 Throttle Normal Priority(%): 0
GPU 0 Throttle Low Priority(%): 0
GPU 0 Slice switch : 0 (0.00/second)
GPU 0 DC6 Exit Reason - Flip: 0 (0.00/second)
GPU 0 DC6 Exit Reason - Register: 0 (0.00/second)
GPU 0 DC6 Exit Reason - Gamma: 0 (0.00/second)
GPU 0 DC6 Exit Reason - Interrupt: 0 (0.00/second)
GPU 0 DC6 Exit Reason - Cursor: 0 (0.00/second)
GPU 0 DC6 Exit Reason - Render: 0 (0.00/second)
GPU 0 FB Test Case 0
**** SMC sensors ****
CPU Thermal level: 19
GPU Thermal level: 0
IO Thermal level: 0
Fan: 2001.43 rpm
CPU die temperature: 65.77 C
GPU die temperature: 58.00 C
CPU Plimit: 0.00
GPU Plimit: 0.00
Number of prochots: 0
For scripted execution, you can limit the output in several ways. If you are only interested in the current temperature and fan speed, sudo powermetrics -n 1 -i 1 --samplers smc
returns these without 5 seconds of waiting.