Time to revive the blog! This first project has nothing at all to do with security, but I guess it is a bit of a hack =].
The purpose of this project was to originally fix the jet engine I created when I upgraded the hard drive in my late 2009 mac mini. The late 2009 model in particular has a hard drive thermal sensor that is completely dependent on the internal sensor of the drive that comes with the computer, and if you replace the drive the fan starts spinning at 6000 RPM nonstop.
I have also confirmed this fix works with macbook pros and airs of the same era, I can’t imagine it wouldn’t work with any mac tho.
Technologies used: Automator, Terminal (including text editor)
Articles exist elsewhere that tell you how to do this in pieces so I can’t take credit for most of it, but here’s a compilation.
Install smcfancontrol: http://www.eidac.de/
Open up automator, create a new application.
On the left, select “Utilities” and double click “Run Shell Script”
Paste this line of code in the box:
/Applications/smcFanControl.app/Contents/Resources/smc –k F0MX –w Zee0
After the ‘–w’ is the hex code for 3000. For whatever reason, for this to work you take the RPM you want, multiply it by 4, and go here to convert it :
So for example, to get 3000 RPM, I put 12000 in the decimal value and that gave me “Zee0”. In my testing I found anything 4000 RPM or below is tolerable, but I just use my mini as a mediaserver and 3000 RPM is plenty for me.
Lastly, save it as something, ideally in your applications folder (i called mine fan_control).
Create a script to fire up your automator program (i use nano for this from terminal):
save it as “~/.wakeup” (this is the default location that sleepwatcher looks for sleep/wakeup scripts, you can also modify sleepwatcher to default to a different location if you want)
Make it executable:
Chmod 700 ~/.wakeup
Download sleepwatcher (you have some options here, I recommend brew. If you don’t already have it, from a terminal run:)
sudo ruby -e "$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then install sleepwatcher from terminal:
sudo brew install sleepwatcher
You can also just browse to the site and download the tarball:
Test out sleepwatcher, make sure it will do what you want. Run this:
/path/to/sleepwatcher –-verbose –-wakeup ~/.wakeup
Now put your machine to sleep and wake it back up. Don’t hear the deafening fan noise anymore? Your script is working! (hallelujah!)
Now that sleepwatcher is working, you need it to run in the background. Since I have multiple accounts on my mini and I want it to run all the time, I elected to install it as a system agent (you need admin rights to do this)
sudo ln -sfv /usr/local/Cellar/sleepwatcher/2.2/de.bernhard-baehr.sleepwatcher-20compatibility.plist /Library/LaunchAgents/
sudo launchctl /Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-20compatibility.plist
That’s it! Welcome back to peace and quiet.