26

I would like to view the current fan speeds of my MacBook and iMac using terminal. I've found that running spindump then cat /tmp/spindump.txt | grep "Fan speed" will show it, but that's very slow and processor intensive. I would like a faster and more efficient way of doing it.

I'd rather not install 3rd party software, but I will if it's the only way.

Does anyone have any suggestions to how I might accomplish this?

Thanks

  • 2
    Point is, as of Mavericks, Apple does not provide a way to query SMC-managed information. Thus, best way would to use smcFanControl, which actually is way more than just a fac control. – Max Ried Jan 20 '14 at 12:28
  • 1
    I do use smcFanControl, but is there any way of accessing its information from terminal? That's what I'm most interested in. – Joseph Jan 20 '14 at 16:52
  • You can use smcFanControl's smc command line tool to get the fan speed; github.com/hholtmann/smcFanControl/tree/master/smc-command – Graham Miln Jan 20 '14 at 17:05
  • You are almost there. spindump has a manpage (man spindump) and you can set the time it needs to run. Answer is below. – CousinCocaine Jan 21 '14 at 8:53
21

smcFanControl

You mention in your comments having smcFanControl installed; this open source project includes the command line tool smc. You can use smc to get fan speed information via Terminal.app:

smc -f

See the smc manual page for more options.

Since Mac OS X 10.5, you need to use a third party piece of software to access the fan speed information. It appears no tool, installed by default on OS X, exposes this information through the terminal.

The open source project Fan Control includes a command line tool that provides fan speed information. This article, OS X: Current CPU temperature on command line, talks about the project and how to extract the fan speed:

smc -k TC0D -r | sed 's/.*bytes \(.*\))/\1/' |sed 's/\([0-9a-fA-F]*\)/0x\1/g' | perl -ne 'chomp; ($low,$high) = split(/ /); print (((hex($low)*256)+hex($high))/4/64); print "C\n";'

Avoid spindump

spindump requires administrator privileges and when run manually, spindump samples user and kernel stacks for every process in the system. This is a computationally expensive process, even when run for one second.

Alternatives

Other tools and applications exist, including Temperature Monitor. See Can I get the CPU temperature and fan speed from the command line in OS X?

Pre-Mac OS X 10.5

This article, get sensor information, shows how to use ioreg to extract the fan speed information with:

ioreg -c IOHWSensor | grep -B3 -A11 '"type" = "fanspeed"'

The above article and the script it contains was designed for Mac OS X 10.4.3.

See also:

  • 1
    Bresink's Temperature Monitor (which I use) is free for reading temperature, but needs a license to read other sensors (e.g. fan speed). – Gilby Jan 21 '14 at 21:33
  • It is good, but works only via command line, to find application go to: cd /Applications/smcFanControl.app/Contents/Resources/ – dr.dimitru May 22 '15 at 17:07
  • 3
    brew install Caskroom/cask/smcfancontrol and using it also requires password. – Nakilon Aug 21 '15 at 16:45
6

Oneliner - gives output after 1 second using spindump

SD=~/.spindump.txt;sudo rm $SD;sudo spindump 1 1 -file "$SD" ;grep "Fan speed" $SD

Each seperate part explained:

SD=~/.spindump.txt: create a variable with the .spindump.txt log

sudo rm $SD: clean up your tmp file using sudo rights, as the file was created by sudo spindump.

sudo spindump 1 1 -file $SD: run spindump as root (it only runs as root) for 1 second in 1 interval and output the file to your $SD

grep "Fan speed" $SD: get the line that says "Fan speed"

It is very unfortunate that we need sudo rights to run this script.


> SD=~/.spindump.txt;sudo rm $SD;sudo spindump 1 1 -file "$SD" ;grep "Fan speed" $SD

Password:
Sampling all processes for 1 seconds with 10 milliseconds of run time between samples
Focusing on launchd [1]
Sampling completed, processing symbols...
Spindump analysis written to file /Users/CousinCocaine/.spindump.txt
Fan speed:       2302 rpm
  • I'm running 10.8.5 on an iMac and my spindump report doesn't include any mention of "Fan speed" or even "fan". – aaaidan Jan 22 '14 at 1:44
  • I am running 10.9.1. I cannot find my 'version' of spindump, but my fan speed is in the first 20 lines. – CousinCocaine Jan 22 '14 at 7:54
  • are you on a laptop or desktop? – aaaidan Jan 22 '14 at 22:13
  • @aaaidan I am running a Mac Mini (Hardware model: Macmini5,3) and an MBP retina (Hardware model: MacBookPro11,1). Both have the variable "Fan speed" in their output. – CousinCocaine Jan 23 '14 at 13:44
  • 1
    Not finding this reliable. on my Macbook I have to take out the Touch part for it to work but then the rm does not work. Also if I run: sudo spindump 1 1 -file /tmp/spindump.txt > /dev/null 2>&1;grep "Fan speed" /tmp/spindump.txt One try it works next try it does not – markhunte Jan 23 '14 at 14:28
0

I've got a MBA with SMC problems and this app solve my issue. The smcFanControl doesn't work for me and I've tryed FanControl too. In GNU/Linux I can set the max and min values thru terminal so if I can in GNU/Linux, I have to do the same in a Unix system. This app is Macs Fan Control https://github.com/crystalidea/macs-fan-control/releases/download/v1.4.12/macsfancontrol.zip

I hope work for you too

0

On Mojave, spindump doesn't seem to list the fan speed. Noticed that powermetrics does, though. Try running sudo powermetrics | grep Fan if you are on Mojave.

  • I just tried, but didn't get any output regarding fan speed, also the man page doesn't indicate anything. How exactly does this work on your Mac? – nohillside May 7 at 10:28
  • powermetrics does take a few seconds to generate the fan speed, so let it run until it samples the SMC. In the man page for powermetrics on 10.14.4, I see the following under the Output description section: "SMC: The smc sampler displays information supplied by the System Management Controller. On supported platforms, this includes fan speed and information from various temperature sensors." My system is a 2018 MacBookPro15,1. – Neil May 12 at 5:13
  • Ah, for whatever reason it fails to read SMC values on my Mac Mini (unable to get smc values). – nohillside May 12 at 9:09
-5

Triple click the following, copy it, and paste it into Terminal:

sudo spindump 1 1 -file /tmp/spindump.txt > /dev/null 2>&1;grep "Fan speed" /tmp/spindump.txt;sudo rm /tmp/spindump.txt

It should output the fan speed.

  • 3
    In the question, he says he does not want to do this exact thing. – Spotlight Aug 15 '15 at 15:12
  • 3
    Plus the question was answered fully last year. – Joseph Aug 16 '15 at 15:43
  • I'd like to add my voice to @Spotlight's. – D A Vincent Oct 19 '16 at 10:26
  • 1
    @Greg - Welcome to Ask Different. The community can seem be a bit brutal here at times which may be a bit off putting for new users such as yourself. I applaud your effort to contribute and wanted to point you toward our Help Center: How to Answer as a resource for writing answers which will attract views and up votes. Don't let the negative votes on your first answer dissuade you from contributing in the future. – Allan Aug 16 '18 at 14:22
-5

You can go into the terminal and type in "sudo_wudo" This will open a folder that monitors the different processes of your computer. The "wudo" should bring you to air flow and pressure which you can go through the menus that can show you the air flow in terminal. This worked very well for me, and I hope you enjoy it too!

  • 3
    -bash: sudo_wudo: command not found. Same problem with sudo wudo, is this a command which needs to be installed first? – nohillside Nov 20 '16 at 10:09

You must log in to answer this question.

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