iMac Fan Control Work-Around

I was recently repairing a 24″ iMac (EMC 2211, Model A1225); to get the
computer up and running again I needed to replace the hard drive. This model
iMac has a sensor that attaches to the hard drive to report temperature metrics
for fan control. The replacement hard drive did not accommodate this sensor so
when the iMac booted up, the fan automatically went to full (and loud) speed.
This is how I revved down and quieted the fan.

The first thing I did was search the Web for a way to interface with
whatever OS X built-in software controls the fan speed. This was not
forthcoming, but in my search I found third-party applications that professed
to be able to help me achieve my ultimate goal of quieting down the fan. One
that came highly recommended was
smcFanControl,
but when I installed it the GUI only provided a way to set the minimum fan
speed (in RPMs). I needed a way to control the max fan speed.

Thankfully the author of this program, Hendrik Holtmann, opened sourced his
work. I visited the github
page
for the project and discovered that smcFanControl had a command line
utility that allowed me to set the max speed.

This utility is located inside the smcFanControl.app and is called
smc. The instructions for using the utility are on this
github
page. The first thing I had to do was switch the fan from auto to
forced mode so that I can make adjustments and apply them. First I tried
to set a target speed for the fan, but when I did that it sounded like the fan
went down to the target speed then right back up to the max. So I went ahead
and set the max speed (adjusting to find the highest RPMs at the lowest noise).
Now I could use the computer without the fan blasting, but these settings would
vanish on reset so I set up a cronjob to apply them at reboot.

TLDR

The Script

When I downloaded and extracted the app, I placed it into
/Applications/Utilities and I placed the startup script in my
$HOME directory and named it fancontrol.sh.

#!/bin/sh

# switch from auto to forced mode
/Applications/Utilities/smcFanControl.app/Contents/Resources/smc -k "FS! " -w 0004

# set the max fan speed (in rpms)
/Applications/Utilities/smcFanControl.app/Contents/Resources/smc -k F2Tg -w 2300

The crontab

Access the crontab for editing:

~$> sudo crontab -e

Add this to the crontab

@reboot /Users/jason/fancontrol.sh
~
~
~