Skip to content
vast-cow's blog
Go back

Controlling CPU Fan Speed on Mac mini 5,2 with Ubuntu 24.04

Edit page

If you have a Mac mini 5,2 (Mid 2011) running Ubuntu 24.04, a convenient setup is to use applesmc + mbpfan. mbpfan 2.4.0 is also included as a standard package in Ubuntu 24.04 (Noble). [Ubuntu Packages][1]

The Linux applesmc driver provides Intel Mac temperature sensors and fan control via sysfs. [GitHub][2]

1. First, check applesmc

sudo modprobe applesmc
sudo modprobe coretemp

lsmod | grep -E 'applesmc|coretemp'

Next, check the fan interface.

SMC=$(find /sys/devices/platform -maxdepth 1 -type d -name 'applesmc.*' -print -quit)
echo "$SMC"

ls -l "$SMC"/fan*

For example, if you see something like this, you can control it.

fan1_input
fan1_manual
fan1_max
fan1_min
fan1_output

Be sure to check fan1_min and fan1_max.

cat "$SMC/fan1_min"
cat "$SMC/fan1_max"
cat "$SMC/fan1_input"

The values will vary depending on the Mac, so it is safer not to assume values like 1800-5500 RPM.


2. Manually change the rotation speed

You can first test it temporarily at, for example, 3000 RPM.

echo 1 | sudo tee "$SMC/fan1_manual"
echo 3000 | sudo tee "$SMC/fan1_output"

Current actual rotation speed:

cat "$SMC/fan1_input"

After a few seconds, it should be around 3000 RPM.

On Intel Macs in Linux, the method of setting fan1_manual=1 and then writing the target RPM to fan1_output is used. [Ask Ubuntu][3]

Return to automatic control

This is important.

echo 0 | sudo tee "$SMC/fan1_manual"

If you leave it in manual mode and fix it at a low rotation speed, the rotation speed will not increase even when the CPU/GPU load increases.


On Ubuntu 24.04,

sudo apt update
sudo apt install mbpfan lm-sensors

Enable:

sudo systemctl enable --now mbpfan

Check status:

systemctl status mbpfan

mbpfan reads the CPU temperature from coretemp and changes the fan speed via applesmc. [GitHub][4]

Configuration:

sudo nano /etc/mbpfan.conf

For example, for Mac mini 5,2, I would first try the following as a gentle setting.

[general]

low_temp = 55
high_temp = 65
max_temp = 80

polling_interval = 1

For the fan’s min/max, mbpfan can use the values reported by applesmc. If you want to specify it explicitly,

cat "$SMC/fan1_min"
cat "$SMC/fan1_max"

and then

min_fan1_speed = 2000
max_fan1_speed = 5500

Set it using the actual values of your machine. mbpfan’s default setting also specifies that it refers to /sys/devices/platform/applesmc.768/fan*_min and fan*_max. [GitHub][5]

After changing:

sudo systemctl restart mbpfan

4. Monitor temperature and RPM in real time

sensors

Or,

watch -n 1 sensors

If you want to see the fan RPM directly:

watch -n 1 "cat $SMC/fan1_input; sensors"

Edit page
Share this post:

Comments


Previous Post
Checking if a Used Core i7-6700 is Genuine Without Benchmarks
Next Post
Why POWER, SPARC, and AIX Were Used in Older HPC Systems