319

Is there a command I can run from the command line in OS X to get the current CPU temperature and/or the fan speed(s)?

To be more specific, I'd like to be able to get the same info available in the iStat widget under the Fans and Temps tabs on the command line.

I'd like to be able to find these values at the command line so it could be scripted and plugged into a monitoring setup on my Mac - I have a data-nerd desire to collect and graph these values (and other stats) on my Macbook over time.

On Linux, it seems like this would be possible by reading a pseudo-file under the /proc directory, but I'm not sure how to do the equivalent on OS X (if it exists).

5
  • I don't know about built-in, but iStat Menus is a menu bar app that includes that info. iStat Nano and iStat Pro are dashboard widgets that also include this information.
    – Arc676
    Commented Jan 25, 2015 at 2:00
  • 3rd party is the only way to go in this situation
    – soulshined
    Commented Jan 25, 2015 at 2:56
  • here is a Terminal + app combo apple.stackexchange.com/a/54332/46541
    – Ruskes
    Commented Jan 25, 2015 at 3:42
  • Simply install smcFanControl open-source App, which shows current speed beside clock (beside allowing manual changing).
    – Top-Master
    Commented Jun 11, 2022 at 8:00
  • To what purpose? What will you do with that data?
    – benwiggy
    Commented Sep 11, 2022 at 20:52

14 Answers 14

268

Option #1) you may consider using inbuilt utility powermetrics to get the cpu and gpu temperature and lot more other details.

To get CPU temperature:

sudo powermetrics --samplers smc |grep -i "CPU die temperature"

enter image description here

To get GPU temperature:

sudo powermetrics --samplers smc |grep -i "GPU die temperature"

To get lot more details:

sudo powermetrics

This has been tested on macbook pro with macOS mojave.

Option #2) Install Intel® Power Gadget officially provided by Intel from here

Intel® Power Gadget and then launch Intel Power Gadget from the launchpad.

enter image description here

Result Screen:

enter image description here

10
  • 6
    The options here are great especially Powermetrics Commented Dec 21, 2019 at 21:05
  • 46
    You can do sudo powermetrics --samplers smc -i1 -n1 to get a single instant sample of SMC sensor readings, including CPU and GPU temprature and fan speed.
    – rjmunro
    Commented Mar 19, 2020 at 17:04
  • 3
    powermetrics doesn't list any temperatures for me, on a 2018 MacMini running Mojave.
    – benwiggy
    Commented Jun 30, 2020 at 10:03
  • 4
    No, sudo powermetrics doesn't work either. "unable to get smc values" on a Mac Mini. I don't like the Intel Gadget, as it installs stuff into the system, and it only shows 1 core, weirdly.
    – benwiggy
    Commented Aug 9, 2020 at 7:51
  • 20
    on m1 I'm getting unrecognized sampler: smc Commented Aug 8, 2021 at 7:55
261

The iStats ruby gem lets you see the CPU temperature via the command-line.

Installation

$ gem install iStats

Usage

$ istats all

Screenshot

14
  • 6
    Unfortunately that's a known error. If you take a look at the Github repo there's a note about it. You can either install Ruby using RVM or brew or use this command to install the gem instead: sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install iStats
    – Chris911
    Commented May 8, 2014 at 6:19
  • 3
    Awesome, works like a charm (nice sparklines too). Just had to do it with "sudo"
    – laander
    Commented Sep 3, 2014 at 15:09
  • 9
    For live updates: watch -n0 istats (I had to brew install watch on OSX before doing the above) See: superuser.com/q/361902
    – user115423
    Commented Jun 22, 2015 at 2:36
  • 9
    To get rid of display errors use this: watch --color istats.
    – Lenar Hoyt
    Commented Jun 28, 2015 at 15:40
  • 4
    You don't have to (and probably shouldn't) use sudo. Instead, use gem install --user-install iStats Commented Jan 8, 2018 at 17:10
48

On BSD systems, the sysctl utility can provides similar information as the /proc tree in Linux. It actually report some CPU/GPU temperature information from Xnu CPU Power Management (XCPM):

sysctl machdep.xcpm.cpu_thermal_level
sysctl machdep.xcpm.gpu_thermal_level

However this doesn't seem to be a temperature reading but only an indication of the temperature level compared to some reference.

8
  • 9
    These 2 commands print machdep.xcpm.cpu_thermal_level: 0 and machdep.xcpm.gpu_thermal_level: 0 on Macos 10.12
    – SebMa
    Commented Sep 26, 2017 at 11:53
  • 3
    On 10.13.4 I get what looks like vaguely credible readings (currently machdep.xcpm.cpu_thermal_level: 58)
    – tripleee
    Commented May 14, 2018 at 12:46
  • what are units ? celsius or fahrenheit, I get as an output: machdep.xcpm.cpu_thermal_level: 93
    – dev_null
    Commented Jun 7, 2019 at 16:32
  • Yeah. What are the units?\
    – Chet
    Commented Aug 15, 2019 at 21:49
  • 2
    These both return 0 for my MBP running the latest macOS (10.15.4). The stock command-line utility powermetrics also shows some "thermal level"s as 0, but happens to also display the CPU/GPU die temperatures which is what I (and I imagine everyone else) actually care about. See Satish's answer and @rjmunro's comment.
    – WD40
    Commented Apr 7, 2020 at 15:23
39

This open source command line utility worked for me: https://github.com/lavoiesl/osx-cpu-temp.

6
  • 4
    I thought it will be harder to compile this, but it's not! Works like a charm! Commented Jul 17, 2015 at 20:37
  • 2
    Thanks, Dust! I'm not much for building stuff from scratch but this was easy and works out of the box. M. Lavoie is using code Apple released a while back: Apple System Management Control (SMC) Tool Copyright (C) 2006 but it works fine on my 2011 Mini. Commented Oct 18, 2016 at 13:54
  • 17
    brew install osx-cpu-temp Commented Jun 4, 2019 at 18:23
  • 3
    Just so you know, the sensor this uses is the CPU Proximity temperature, which is different from the CPU PECI (overall CPU temperature) and each core's individual temperatures, that are often significantly higher than the CPU Proximity. Macs Fan Control reports CPU Proximity on my Mac as 55ºC, but CPU PECI as 63ºC Commented Aug 14, 2020 at 0:15
  • 3
    Reports 0.0°C on mac studio (arm) Commented Jul 19, 2022 at 15:28
20

Update: @PressingOnAlways has notified me that this software is now considered legacy by its developer. Further details on the stopped support can be found on their legacy-software website.

Install Temperature Monitor and, assuming you installed it in /Applications, run the following: /Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -c -l -a

You can also use the updated (however no longer in development, but downloadable) Hardware Monitor from the same author: /Applications/to/HardwareMonitor.app/Contents/MacOS/hwmonitor

8
  • 1
    Thanks for this. I take it if I need to install this third-party app for it, there isn't a known built-in way to do the same?
    – matt b
    Commented Jun 21, 2012 at 15:30
  • 2
    No, I don't think there is. I've used that same program to display the values with Geektool for a time but didn't find any information about a built-in tool. Mind you that that was more than a year ago, so there ,ight be now. I doubt it though. Commented Jun 21, 2012 at 22:31
  • 2
    Note TemperatureMonitor does not support any Macs made after October 2013, or so it told me when I tried to run it on my MacBookPro Retina.
    – Paul
    Commented Jul 30, 2014 at 2:29
  • 3
    As of Oct 1st, Temperature Monitor has been suspended - they went "Pro".
    – eduncan911
    Commented Oct 21, 2014 at 19:54
  • 7
    this no longer is viable as this software is no longer kept up to date. Commented May 13, 2015 at 0:50
15

The SMC sampler is not available on the M1 (or on Big Sur, not sure which). You can get frequencies and power usage for CPU and GPU with powermetrics, but not the temperature, as far as I can tell.

The temperature can probably still be read from the SMC, but it looks like the keys changed for the M1, and might even be different between the M1 models.

1
  • 1
    This should be a comment, not an answer.
    – huyz
    Commented Jan 4 at 17:30
6

There are two main ways to view your CPU stats if you don‘t want to install additional software you can view a lot of details from the terminal / command line.

  1. Type on the terminal...

    sudo powermetrics
    

    And at the bottom you will see the following:

    **** SMC sensors ****
    
    CPU Thermal level: 51
    GPU Thermal level: 35
    IO Thermal level: 1
    Fan: 2060 rpm 
    CPU die temperature: 88.36 C (fan) 
    GPU die temperature: 74.38 C 
    CPU Plimit: 0.00 
    GPU Plimit (Int): 0.00  
    GPU2 Plimit (Ext1): 0.00
    
  2. Or try typing. (But Apple maybe removed the details from this to just numbers 0 or 1?)

    sysctl -a | grep cpu | more
    

    Or thermal / temperature details only?

    sysctl -a | grep thermal 
    

    The output should look like this:

    hw.ncpu: 8
    hw.activecpu: 8
    hw.physicalcpu: 4
    hw.physicalcpu_max: 4
    hw.logicalcpu: 8
    hw.logicalcpu_max: 8
    hw.cputype: 7
    hw.cpusubtype: 8
    hw.cpu64bit_capable: 1
    hw.cpufamily: 280134364
    hw.cpufrequency: 2800000000
    hw.cpufrequency_min: 2800000000
    hw.cpufrequency_max: 2800000000
    hw.cputhreadtype: 1
    machdep.cpu.max_basic: 13
    machdep.cpu.max_ext: 2147483656
    machdep.cpu.vendor: GenuineIntel
    machdep.cpu.brand_string: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    machdep.cpu.family: 6
    machdep.cpu.model: 70
    machdep.cpu.extmodel: 4
    machdep.cpu.extfamily: 0
    machdep.cpu.stepping: 1
    machdep.cpu.feature_bits: 9221960xxxxxx657855
    machdep.cpu.leaf7_feature_bits: 10155 0
    machdep.cpu.leaf7_feature_bits_edx: 261xxxxxx2
    machdep.cpu.extfeature_bits: 1424xxxxxx52
    machdep.cpu.signature: 263777
    machdep.cpu.brand: 0
    machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
    machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 SMEP BMI2 ERMS INVPCID FPU_CSDS MDCLEAR IBRS STIBP L1DF SSBD
    machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI
    machdep.cpu.logical_per_package: 16
    machdep.cpu.cores_per_package: 8
    machdep.cpu.microcode_version: 28
    machdep.cpu.processor_flag: 5
    machdep.cpu.mwait.linesize_min: 64
    machdep.cpu.mwait.linesize_max: 64
    machdep.cpu.mwait.extensions: 3
    machdep.cpu.mwait.sub_Cstates: 270624
    machdep.cpu.thermal.sensor: 1
    machdep.cpu.thermal.dynamic_acceleration: 1
    machdep.cpu.thermal.invariant_APIC_timer: 1
    machdep.cpu.thermal.thresholds: 2
    machdep.cpu.thermal.ACNT_MCNT: 1
    machdep.cpu.thermal.core_power_limits: 1
    machdep.cpu.thermal.fine_grain_clock_mod: 1
    machdep.cpu.thermal.package_thermal_intr: 1
    machdep.cpu.thermal.hardware_feedback: 0
    machdep.cpu.thermal.energy_policy: 1
    machdep.cpu.xsave.extended_state: 7 832 832 0
    machdep.cpu.xsave.extended_state1: 1 0 0 0
    machdep.cpu.arch_perf.version: 3
    machdep.cpu.arch_perf.number: 4
    machdep.cpu.arch_perf.width: 48
    machdep.cpu.arch_perf.events_number: 7
    machdep.cpu.arch_perf.events: 0
    machdep.cpu.arch_perf.fixed_number: 3
    machdep.cpu.arch_perf.fixed_width: 48
    machdep.cpu.cache.linesize: 64
    machdep.cpu.cache.L2_associativity: 8
    machdep.cpu.cache.size: 256
    machdep.cpu.tlb.inst.large: 8
    machdep.cpu.tlb.data.small: 64
    machdep.cpu.tlb.data.small_level1: 64
    machdep.cpu.tlb.shared: 1024
    machdep.cpu.address_bits.physical: 39
    machdep.cpu.address_bits.virtual: 48
    machdep.cpu.core_count: 4
    machdep.cpu.thread_count: 8
    machdep.cpu.tsc_ccc.numerator: 0
    machdep.cpu.tsc_ccc.denominator: 0
    machdep.xcpm.cpu_thermal_level: 0
    

    You will notice the frequency details and also some thermal info. You can also grep thermal if you are only interested in that.

1
  • 1
    I would love it if sysctl actually showed the temperature, it would be so easy, fast and integrated... but it reports only 0 or 1 on a 2014 Mac Mini running the latest macOS Mojave Commented Aug 14, 2020 at 0:16
4

OS X does not offer this functionality. smcFanControl and the iStat widgets are the typical go-to choices for this issue. I personally use smcFanControl. It gives me both the temperature and the ability to monitor fan operation.

1
  • NOTE: iStat Pro isn't available from Bjango any more, but this MacRumors thread has download links for patched versions. You may have to scroll around a bit to find the most recent version, but it's free (always has been, no piracy here) and IMO is overall better than Menus even though it's not supported.
    – JMY1000
    Commented Feb 19, 2016 at 19:41
2

The tool osx-cpu-temp works perfectly for me ! (thanks) I made a little script to actuate the value each second and to prettify the output (it uses toilet for the pretty-output) :

while true; do; clear; osx-cpu-temp | toilet -f smblock; sleep 1; done;

Using ITerm2, I made a profile that lauches this command just after logging. ITerm2 can also store a window arrangement, so I stored one with tty-clock, htop and my command (named it cpu-temp) sized like a status bar, with very small font.

1

I tried to improve option #1 from Satish's answer to display information related to the SMC sensors:

sudo powermetrics | sed -n '/\*\*\*\* SMC sensors \*\*\*\*/,/Number of prochots/p'

1

Another new CLI tool that does this very well is iSMC: https://github.com/dkorunic/iSMC

Here's a screenshot of some of the output: enter image description here

It doesn't show eGPU temperature, but that info exists in ioreg somewhere. You can extract some stats about your GPU/eGPU manually from ioreg with this:

ioreg -l | grep '"PerformanceStatistics"' | sed -E "s/,/\\n/g;s/\"//g" | grep -E "(temp|power|Device Utilization|Fan|speed|GPU Activity)"

If you have multiple GPUs their stats will be mixed. I select just my Vega 56 eGPU like this:

ioreg -c AMDRadeonX5000_AMDVega10GraphicsAccelerator -r -l | grep '"PerformanceStatistics"' | sed -E "s/,/\\n/g;s/\"//g" | grep -E "(temp|power|Device Utilization|Fan|speed|GPU Activity)"

...

Device Utilization %=7
Fan Speed(%)=0
GPU Activity(%)=16
Fan Speed(RPM)=0
Temperature(C)=36
Total Power(W)=35

1

Not sure this is possible without any external tools, but if you're looking for something small/lightweight (and open source) I highly recommend Stats.

It includes a commandline tool, at /Applications/Stats.app/Contents/Resources/smc which can be symlinked to /usr/local/bin for convenience.

E.g to list all temps/sensors:

smc list -t
0
1

The smc values for temperature sensors are accessible via ObjectiveC with swift bindings and several python libraries and packages take advantage of this to make it easy to pull values.

https://github.com/nicolargo/glances

This one on python has auto-update && colors built-in and can be installed with a simple curl or wget command if requirements are already met.

Requirements

  • python >= 2.6 or >= 3.3 (tested with version 2.6, 2.7, 3.3, 3.4)
  • psutil >= 2.0.0
  • setuptools
2
  • This answer works very well with modern os in the fall of 2022
    – bmike
    Commented Sep 11, 2022 at 18:48
  • Why not just brew install glances?
    – Tmanok
    Commented Feb 9, 2023 at 6:26
0

On my mid-2011 MacMini with OSX 10.13.6 I use smc to set and check the fan speed plus osx-cpu-temp for the temperature.

https://github.com/hholtmann/smcFanControl

https://github.com/lavoiesl/osx-cpu-temp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .