Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Paddy OPlastic

macrumors newbie
Original poster
Dec 23, 2025
4
0
I'm attaching a simple bash script for controlling the three fans of an iMac 10,1 (late 2009) under Linux. It should be adaptable for similar models. When replacing the original hard drive with an SSD the drive temperature sensor is no longer available resulting in the HDD fan running at full speed. The mbpfan daemon works well for a MacBook but only uses the CPU temperature to control all fan speeds and so it isn't suitable for the iMac. I also find that the default fan profile makes my machine run very hot.

It assumes that the mechanical hard drive has been replaced with a SMART capable SSD. If this isn't the case then the SSD temperature sensing can be removed.

It uses the applesmc module to access the iMac temperature sensors and the drivetemp module to access the SSD temperature sensor. It controls the fans individually based on the sensor values. The drivetemp module will probably not be loaded on your system by default so it will need to be configured to load at boot. The instructions are in the script. If you've been using a different method to control fan speed (like mbpfan) then you'll need to disable this first.

This script works well as a systemd service and the installation instructions are also in the script.

In the script there are a set of parameter variables *_HIGH_TEMP and *_MAX_TEMP for each sensor being monitored. The former sets the temperature after which the fan speed starts to rise, and the later sets the temperature at which the fans will be running at full speed. I have set these to provide the optimum cooling for my iMac under various loads. You may find you want to tweak the parameters for your system. I found the psensors application very useful for tuning these parameters. The fan speeds are calculated every 5 seconds although you can choose a different frequency in the main loop of the script.

The optical drive fan is controlled by the GPU die temperature (my optical drive is kaput). The hard disk fan is controlled by the memory proximity temperature as well as SSD temperature. The CPU fan is controlled by CPU core temperatures and PSU heatsink temperature. The memory temperature could be swapped for the Northbridge temperature (TN0H, temp 20) but they both track each other quite closely on my iMac. Bear in mind that if you are adapting the script for a different model then the physical location of the devices and their sensors with respect the fans may be different.

I'm a reluctant bash coder and I'm not a systemd expert. I welcome any improvements or comments.
 

Attachments

  • fancontrol.sh.txt
    7.2 KB · Views: 1
I found an easy way to calm the fans down in my iMac back then. In 2013 I made this post where at first I was using software to control them. But at the bottom of the post I updated it to say that I found a hardware way to accomplish this.
I don't know why I didn't think of this at the time, but I believe I found a better way to keep the fan under control.

I took a bad hard drive and removed it's controller board which has the jumper pins on it and put that inside the iMac. I connected the HDD sensor wire to the jumper pins, just as it was when the original HDD was inside the machine and operating. Only this time, it's just the controller board with no power. I used a small piece of 2-sided 3M tape to keep it from moving around and stuck the controller board to the SSD.

I have removed smcFanControl from my start up items along with the app Scenario and my AppleScript that I used to control the fan speed during various system events.

I've restarted the machine a couple of times, put it to sleep and woken it up (which is the part where I couldn't control the fan with software), put it back to sleep and accessed the iTunes library to play a video on the Apple TV and so far everything is working and under control.

I figured that Apple was only measuring the temperature of the HDD via the jumper pins themselves and not actually reading any temperature data being sent by the HDD or its controller.

Basically, I just added a dummy load to the sensor and as far as it knows, there is a functioning HDD attached to it.

I'm running through all my start/restart/sleep/network access tests a second time now, but I think I got it.
 
I found an easy way to calm the fans down in my iMac back then. In 2013 I made this post where at first I was using software to control them. But at the bottom of the post I updated it to say that I found a hardware way to accomplish this.
Yes the sensor is just a simple thermistor or something similar and I believe you can get substitutes from eBay. It was a good idea to cannibalise the old drive but my machine came to me driveless.
 
Yes the sensor is just a simple thermistor or something similar and I believe you can get substitutes from eBay. It was a good idea to cannibalise the old drive but my machine came to me driveless.
For $20 on eBay you can get some assorted hard drives for "parts only."
 
Your hardware solution is fine. What I really don't want is for people to think using mbpfan on an iMac is fine. It isn't.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.