167

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).

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.

Assuming you installed it in /Applications you'd need to run the following:

/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -c -l -a

Site: Temperature Monitor

| improve this answer | |
  • 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 Jun 21 '12 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. – GhostLyrics Jun 21 '12 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 Jul 30 '14 at 2:29
  • 3
    As of Oct 1st, Temperature Monitor has been suspended - they went "Pro". – eduncan911 Oct 21 '14 at 19:54
  • 7
    this no longer is viable as this software is no longer kept up to date. – PressingOnAlways May 13 '15 at 0:50
220

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

Installation

$ gem install --user-install iStats

Usage

$ iStats

Screenshot

| improve this answer | |
  • 5
    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 May 8 '14 at 6:19
  • 2
    Awesome, works like a charm (nice sparklines too). Just had to do it with "sudo" – laander Sep 3 '14 at 15:09
  • 8
    For live updates: watch -n0 istats (I had to brew install watch on OSX before doing the above) See: superuser.com/q/361902 – jasonszhao Jun 22 '15 at 2:36
  • 8
    To get rid of display errors use this: watch --color istats. – Lenar Hoyt Jun 28 '15 at 15:40
  • 2
    You don't have to (and probably shouldn't) use sudo. Instead, use gem install --user-install iStats – Michael - Where's Clay Shirky Jan 8 '18 at 17:10
63

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|grep -i "CPU die temperature"

enter image description here

To get GPU temperature:

sudo powermetrics|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

| improve this answer | |
  • 3
    The options here are great especially Powermetrics – heretoinfinity Dec 21 '19 at 21:05
  • 13
    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 Mar 19 at 17:04
  • 3
    +1 for a solution that doesn't require installing anything. Thanks! – jamzsabb Apr 28 at 21:56
  • powermetrics doesn't list any temperatures for me, on a 2018 MacMini running Mojave. – benwiggy Jun 30 at 10:03
  • @benwiggy you can try sudo powermetrics and see if it return other meaningful info, check powermetrics man page. Or option#2 you can give it a try. – Satish Jun 30 at 14:32
37

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.

| improve this answer | |
  • 5
    These 2 commands print machdep.xcpm.cpu_thermal_level: 0 and machdep.xcpm.gpu_thermal_level: 0 on Macos 10.12 – SebMa Sep 26 '17 at 11:53
  • 2
    On 10.13.4 I get what looks like vaguely credible readings (currently machdep.xcpm.cpu_thermal_level: 58) – tripleee May 14 '18 at 12:46
  • what are units ? celsius or fahrenheit, I get as an output: machdep.xcpm.cpu_thermal_level: 93 – dev_null Jun 7 '19 at 16:32
  • Yeah. What are the units?\ – Chet Aug 15 '19 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 Apr 7 at 15:23
34

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

| improve this answer | |
  • 2
    I thought it will be harder to compile this, but it's not! Works like a charm! – Aron Lorincz Jul 17 '15 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. – Tai Viinikka Oct 18 '16 at 13:54
  • 9
    brew install osx-cpu-temp – seeker_of_bacon Jun 4 '19 at 18:23
2

Im on OSX 10.11

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
| improve this answer | |
  • 3
    Glances doesn't show me fanspeed and cpu temp. (MBP 13" 2012, OSX 10.12) – CodeBrauer Dec 31 '16 at 10:48
  • @agusti-pardo On Macos 10.12: psutil.cpu_temperature() AttributeError: 'module' object has no attribute 'cpu_temperature' – SebMa Sep 6 '17 at 16:57
  • @Agusti-Pardo > temperatures are currently not supported on OSX See this : github.com/giampaolo/psutil/issues/1134#issuecomment-332173195 – SebMa Sep 26 '17 at 11:51
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

| improve this answer | |

You must log in to answer this question.

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