a beginner's tutorial for mbpfan under ubuntu


Update: As of 2019-10-14, this project is being maintained by the community linux-on-mac. Please head to https://github.com/linux-on-mac/mbpfan to download the latest release of mbpfan and to report bugs. The project has also changed since the publication of this tutorial. Thanks!

Although mbpfan is not a program for everyone (heck, I do not even provide compiled packages for distros), I received several requests for an easy, step-by-step tutorial for installing mbpfan for Ubuntu. Here is my attempt. The present tutorial was written using Ubuntu 15.10, after a fresh install.

First thing to do is to take note of the configuration parameters for mbpfan settings. Let’s start with the fan speed’s min and max values that the system was able to detect. Open a terminal, and type the following commands, one at a time.

cd /sys/devices/platform/applesmc.768/
cat fan*_min
cat fan*_max

Note down the lowest among the numbers for fan__min. _For example, I got 1299. Note down the highest among the numbers for _fan__max. _For example, I got 6199. These two values are your _min_fan_speed and max_fan_speed values for mbpfan configuration.

Now, see what are the max values that the system was able to detect for the temperature.

cat /sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_max

Note down the highest among the numbers you might obtain. Divide the number by 1000. The value you will obtain is _max_temp _value for mbpfan configuration. For example, I got 105000. Therefore, my max_temp is 105.

Second thing to do is to obtain and install mbpfan. Download the latest .tar.gz version of the source code from mbpfan tag/release page.

Assuming that the download will land to the Downloads folder, and that the file you download is mbpfan-1.9.1.tar.gz (the -1.9.1 part will change in the future). Open the terminal, go to the downloads folder, extract mbpfan, and enter the source code directory.

cd ~/Downloads/
tar xfvz mbpfan-1.9.1.tar.gz
cd mbpfan-1.9.1

Install the build-essential package, which contains what is required for compiling basic source code like the one of mbpfan.

sudo apt-get update && sudo apt-get install build-essential

The command sudo lets you execute commands as the root user. The first time you use sudo, you need to supply your user password. It is completely normal that you won’t see any star (***) appearing here. Just type the password and press enter.

You might receive the message that “build-essential is already the newest version”. All good if you have got it already.

Compile, install, and test mbpfan.

sudo make install
sudo make tests

You should receive some text, which has to tell you that “ALL TESTS PASSED”. If not, please contact me.

Third thing to do is to configure mbpfan. Open the configuration file using a text editor (like Gedit) with root access.

sudo gedit /etc/mbpfan.conf

The content of the file will be the following:


min_fan_speed = 2000    # default is 2000
max_fan_speed = 6200    # default is 6200
low_temp = 63            # try ranges 55-63, default is 63
high_temp = 66            # try ranges 58-66, default is 66
max_temp = 86            # do not set it > 90, default is 86
polling_interval = 7    # default is 7

Change the values of min_fan_speed, max_fan_speed, and max_temp to the values that your marked down at the beginning of this tutorial.

As example, this is my resulting file.

min_fan_speed = 1299    # default is 2000
max_fan_speed = 6199    # default is 6200
low_temp = 63            # try ranges 55-63, default is 63
high_temp = 66            # try ranges 58-66, default is 66
max_temp = 105            # do not set it > 90, default is 86
polling_interval = 7    # default is 7

You might note that for max_temp, I suggest to never setting the value above 90. Yet, I got 105. You can set it to any value smaller (never bigger) than the one you obtained before. This is for having a more conservative system. The max_temp value is what mbpfan considers a critical temperature, where the fans have to be set immediately at the maximum possible speed.

The low_temp _option can be as low as 50-55 degrees (according to your CPU model). Feel free to try different settings for this value and for _high_temp. Mbpfan attempts to keep a low fan speed if the temperature is between low_temp to high_temp.

Finally, turn mbpfan into a system service. Be sure to be back into mbpfan source directory, in the Downloads folder. Then, run the following two commands:

sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service

Reboot your system. In order to check that mbpfan is up and running, open a terminal again, and give the following command.

ps aux | grep mbpfan

If there is a line ending with /usr/sbin/mbpfan, you are good to go.

You can delete the files in the Downloads folder, they are not needed anymore.

Once an update of mbpfan is released, you just have to extract the new source files, enter the directory, and give the commands make, sudo make install, and sudo make tests. The configuration file does not get overwritten when updating mbpfan.

I wish you a happy, fresh Macbook. Did you find a bug? Please describe your issue at mbpfan’s Github issue tracker.

I do not use a commenting system anymore, but I would be glad to read your feedback. Feel free to contact me.