Recently I noticed that my iMac was getting too hot. This even after running an external fan next to it. It’s late 2009 model and more than 3 yrs old. It is likely that it’s clogged inside with dust. I tried my best to get rid of the dust along the various vents in the back. But it’s still getting hot. For example the Secondary Heat Sink has gone to a max of 96 degrees Centigrade! Yes, that’s a C and not F. The machine hasn’t shutdown or panic. I was :).
Researched online and tried a few options but nothing worked. It appears that the latest version of OS X, perhaps starting from Lion, the fans are not started up to a very high temperatures. Infact, the Intel Core i7 CPUs can apparently withstand up to 130 degrees C. Perhaps the iMacs that came in 2010 and later have something special that these later OS X versions were able to keep the fans low. That I don’t know. But I fixed my problem with a simple cron job that adjusts the fan temperature based on the Secondary Heat Sink temperature (I choose this sensor because this is the temperature that is reaching the max).
Below is the script and it uses two freely available software. One is smcFanControl. This allows adjusting the fan speed. The other is TemperatureMonitor that provides the temperature reading. Both these programs have GUI, but they also offer command line interface. So, the following shell script setup as a cron to run every 2 minutes adjusts the temperature and now I don’t even have to bother about turning on the external fan.
#!/bin/sh
smc=/Applications/smcFanControl_2_3/smcFanControl.app/Contents/Resources/smc
T=`/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -l -a | grep 'SMC SECONDARY HEATSINK' | sed -e 's/.*: \(..\) C/\1/'`
if test $T -ge 90;
then
# set Fan 2 to forced mode
$smc -k "FS! " -w 0004
$smc -k F2Tg -w 1F40
#echo "setting fan to 2000 RPM"
elif test $T -ge 80;
then
# set Fan 2 to forced mode
$smc -k "FS! " -w 0004
$smc -k F2Tg -w 1770
#echo "setting fan to 1500 RPM"
elif test $T -ge 70;
then
# set Fan 2 to forced mode
$smc -k "FS! " -w 0004
$smc -k F2Tg -w 12C0
#echo "setting fan to 1200 RPM"
else
# set Fan 2 to forced mode
$smc -k "FS! " -w 0000
#echo "setting fan to auto"
fi
I just experimented and setup 3 different fan speeds for 3 different temperature ranges. I am not sure if this is the most optimal. Once you play around with this, you get the idea and you can adjust as per your needs.
Update: I upgraded to OS X 10.9 (Maverics) and it seems the OS is doing it’s job of turning the fan on. So, I disabled my cron job. If I see the system heating up again and the fan not working, I will turn it on. Also, based on how the OS is turning the fan on, may be I need to adjust the above values which seem to be on low for the span feed.