As it happened to many of you after installing Snow Leopard a couple of years ago the fan of my MacBook went crazy. Even at low CPU temperatures (60 C) it keeps staying at 6200 rpm. The bizarre thing is that putting the MB on sleep and waking it up the rpm stays low. I tried the standard procedure (reset SMC and PRAM, as explained in Apple documents) but nothing changed. Then I've found
this page, which makes use of the
smc binary of smcFanControl tool. You may find smcFanControl
here.
Then from Terminal I typed (the $ sign is the prompt. Don't type it):
$ cp ~/Downloads/smcfancontrol_2_2_2/smcFanControl.app/Contents/Resources/smc /usr/local/sbin
The problem with this hint is that my MacBook DOES heat and keeping a low rpm it overheated causing a crash/shutdown. So, after some investigations on how to read the temperature I came out with the following script, which I stored in
/usr/local/sbin/smcFanReset.
!/bin/sh
#
# Read CPU0 temperature via smc tool and convert in decimal value
#
TEMP=$((0x$(/usr/local/sbin/smc -k TC0D -r|awk '{print $4}')))
#
# Depending on the actual temperature value adjust the maximum fan speed.
#
if [ $TEMP -le 62 ]
then
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(3000 << 2)[2:]')
elif [ $TEMP -le 66 ]
then
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(3600 << 2)[2:]')
elif [ $TEMP -le 70 ]
then
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(4200 << 2)[2:]')
elif [ $TEMP -le 75 ]
then
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(5000 << 2)[2:]')
else
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(6200 << 2)[2:]')
fi
# END OF SCRIPT
This is obviously a run once only script; useless when the CPU changes its temperature.
To have it always checking the CPU temperature and adjusting the max fan speed accordingly one just needs to run it with cron. I choose to have it run every minute. To do so type in terminal:
$ sudo crontab -e"
This starts vi on the root crontab file. Append the entry:
*/1 * * * * /usr/local/sbin/smcFanReset
Save and quit. Cron will be automatically updated to read the new entry and your MacBook, will be (mostly) quiet again as it should be.
A few notes:
This script modifies the maximum rpm for fan0. Simply the fan speed can not get higher than that, so use it carefully. I decided that for temperatures > 75 C it should use full speed.
The smc is still in control of the fan speed. If the CPU temperature drops it may decide to lower the rpm even more.
This works only for 'fan0' with the MacBook having only one fan. I can't test it but I imagine that on MacBook Pro for each temperature one should add the line:
/usr/local/sbin/smc -k F1Mx -w $(python -c 'print hex($RPM << 2)[2:]')
as in:
if [ $TEMP -le 62 ]
then
/usr/local/sbin/smc -k F0Mx -w $(python -c 'print hex(3000 << 2)[2:]')
/usr/local/sbin/smc -k F1Mx -w $(python -c 'print hex(3000 << 2)[2:]')
elif ...
The maximum allowed rpm by the SMC is greater than 6200. One may want to raise it at his/her own risk. Obviously it will be much louder.
Do not expect your MacBook to be much cooler. Just more silent.
Again, use this at your own risk. The values I have set fit with my regular usage. The temperature goes above 75 C when watching videos and stuff and as long as it didn't hit the 80+ C a lower rpm didn't overheat the MacBook. Also the one minute delay is not much to have a drastic raise on CPU temperature. I have been running this for few days now and it is pretty stable.
[
crarko adds: I haven't tested this one.]