Jan 30, 2016

A beginner’s tutorial for mbpfan under Ubuntu

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.

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.

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.

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

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.

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.

The content of the file will be the following:

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.

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:

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

If there is a line ending with /usr/sbin/mbpfan -fv , 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.

written by dgraziotin

Dr. Daniel Graziotin received his PhD in computer science, software engineering at the Free University of Bozen-Bolzano, Italy. His research interests include human aspects in empirical software engineering with psychological measurements, Web engineering, and open science. He researches, publishes, and reviews for venues in software engineering, human-computer interaction, and psychology. Daniel is the founder of the psychoempirical software engineering discipline and guidelines. He is associate editor at the Journal of Open Research Software, academic editor at the Research Ideas and Outcomes (RIO) journal, and academic editor at the Open Communications in Computer Science journal. He is the local coordinator of the Italian Open science local group for the Open Knowledge Foundation. He is a member of ACM, SIGSOFT, and IEEE.

  • Taylor Feb 19, 2016 Reply

    Great write-up. Looking forward to trying this sometime this weekend.

    I recently installed 14.04 Server on a Mac Mini 7,1 (Late 2014). After about a day of running, I noticed it was VERY hot when I came home from work. I began to look into fan controllers/daemons, but haven’t been too successful.

    I tried macfanctl, but the fan just ran at 6200 RPMs from the get go and even when I stopped the daemon, it continued to run at max speed. I’ve begun to look at macfanctld logging and seeing if I could turn off/ignore certain sensors (when reporting negative temps) as many have advised in postings/communities/forums, but haven’t had too much time to try it.

    Long story short…have you had any success with mbpfan working on a Mac Mini? This write-up makes me feel mbpfan may be a better option. Thanks in advance.

  • karananand Feb 25, 2016 Reply

    after installing build-essential when i type “make” it says “make: *** No targets specified and no makefile found. Stop.”

  • karananand Feb 25, 2016 Reply

    “sudo cp mbpfan.service /etc/systemd/system/” -this says there is no such file or directory

    • dgraziotin Feb 26, 2016 Reply

      My guess is that you are not typing both commands from within mpbfan source directory.

  • karananand Feb 26, 2016 Reply

    i typed within source but it says “cp: cannot stat ‘mbpfan.service’: No such file or directory”.Any way finally i was able to start the fan manually by typing “sudo mbpfan” Thanks author. Mbpfan works perfectly with manual start,finally i got a better solution from ur tutorial thanks.

    • dgraziotin Feb 27, 2016 Reply

      That file is in the root directory of the source file. Both that issue and the previous one you reported regarding the use of the make command show that the files are not in the directory you are in. I have also checked the tutorial again to be safe.

      In any case, glad that it is working now!

  • stíobhart May 9, 2016 Reply

    I’ve recently installed Ubuntu Mate 16.04 on an old unused MBP and the fans were continually screaming at full speed, so the thing sounded like it was about to take off.

    [Actually, I seem to remember it doing this way back when I used it with OSX too, but that’s beside the point]

    When I ran cat fan*_min and cat fan*_max I actually got results where the min speed [6200] was higher than the max speed [6000]. No wonder the wee thing was confused!

    Anyway, Macfantld didn’t make any difference, so I installed mbpfan using these excellent instructions [I’m a lazy sod. I hate having to build from source!] and my old MBP is now purring instead of doing helicopter impersonations. So thumbs up from me!

  • Aelevision May 9, 2016 Reply

    After completing the installation, I rebooted and entered the commands to check if mbpfan was running. Instead of receiving a line ending with ” /usr/sbin/mbpfan -fv”, I received this…

    “aelevis+ 2905 0.0 0.0 21296 948 pts/17 S+ 13:22 0:00 grep –color=auto mpbfan”

    Does this mean it’s not running? Thanks!

    • Aelevision May 9, 2016 Reply

      Okay, after a full shutdown and restart I received a line with that path directory. Thanks for the great tutorial. I will share!

  • Edwin May 10, 2016 Reply

    When I want to upgrade the kernel of my ubuntu, do I need to compile mbpfan again or will it stay where it is, and work as it should.

    • dgraziotin May 10, 2016 Reply

      It is supposed to keep working. There might be issues if the new kernel introduces major changes to Coretemp. It happened once, in 2014.

  • GeneralRage May 17, 2016 Reply

    hi guys from some strange reason i get that systemctl dose not work (linux mint or ubuntu)
    generalrage@generalrage-MacBookPro ~/Preuzimanja/mbpfan-1.9.1 $ sudo systemctl enable mbpfan.service
    sudo: systemctl: command not found

    • John Jul 11, 2016 Reply

      Which version of Ubuntu are you running? systemctl is the control command for systemd – the services/init daemon for Ubuntu 15.04 and up. If you’re running an older version of Ubuntu, you’re using the upstart daemon instead, which uses the initctl command. A startup file called mbpfan.upstart comes along for the ride; you’ll want to copy this to /etc/init, then restart.

  • Shane Haggerty Jun 14, 2016 Reply

    If I want to edit the configuration file after following the instructions am I able to? I’m getting the error [** (gedit:4204): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported] when I try to edit it after the initial setup.

    • dgraziotin Jun 14, 2016 Reply

      This is very likely just a series of warnings that you get when launching a graphical app from the terminal. In your case, it is gedit. It is not related to mbpfan and it will never cause any issue to..anything. In other words: do not worry!

      • Shane Sep 4, 2016 Reply

        The last installation worked great, thanks for the timely reply. I’m trying to install it again only this time when I enter the “sudo systemctl enable mbpfan.service” command I am getting the response “Unknown operation enable mbpfan.service.”

  • Ben F Jun 20, 2016 Reply

    I installed this package because the one I was using before had the fan running at maximum just after boot on a MATE desktop with nothing running. Unfortunately the same is happening with this one. Only for the few minutes after purging the old one and restarting did I have silence.

    Do I have to choose between silence and the risk of overheating? How much of a risk is it? Or is there a problem with the fan itself?

    I wish I could go back in time to when I bought this MBP and just have bought something else instead. Anything would have done. Worst grand I ever spent.

  • Daniel Graziotin Jun 21, 2016 Reply

    This happens sometimes when booting GNU/Linux after a Mac OS X session. Is that your case?

    Could you clarify what you mean with

    Only for the few minutes after purging the old one and restarting did I have silence.

    Also, what happens if you leave it running at maximum speed for a couple of minutes (say, 5)? Does mbpfan eventually lower the fan speed?

  • Johnathan Lemus Jul 2, 2016 Reply

    Excellent Tutorial, but I still can’t get it to work. I have an old Mac Mini from 2009 that i outfitted with a new SSD and Ubuntu 16.04. It now runs fabulously but the fan does not spin which is a huge problem. I know that Ubuntu doesn’t have support for the Mac fan out of the box, but I can’t even take manual control of the fan. The fan has only ever turned on once randomly.

    • Daniel Graziotin Jul 4, 2016 Reply

      Hi, please open an issue here and describe your problem as much detailed as possible. Actually, your comment made me realize that I should mention the issue tracker on this post. Cheers!

  • John Jul 11, 2016 Reply

    Just installed mbpfan on a mac mini 2,1 (Core 2 Duo, 1.83 GHz) running Ubuntu 16.04. So far working a treat: fan reports as running at 2000 RPM. Will keep an eye on the output of the {{sensors}} command and see how things hold up over the next few days.

    • dgraziotin Jul 12, 2016 Reply

      Thanks, just added to the list of devices!

  • carl Jul 27, 2016 Reply

    Thanks for writing this I was a bit lost at first.

  • Jose Aug 3, 2016 Reply


    First, thank you for your work, and to put it at reach or everyone.
    Tested successfully on MacBookAir Early 2015 (7,2) on Arch Linux (kernel 4.6.1) using yaourt. I’ve try changing min value of fan in mbpfan.conf, restarted daemon and view changes on RPM using ‘lm_sensors’


  • Jason Aug 17, 2016 Reply

    Seems to be working fine on MacBook Pro mid 2009. Nice work!

  • Nicolas Sep 1, 2016 Reply

    I just installed it flawlessly on an imac 11,3 running ubuntu 16.04. Thanks.

  • snowmusicman Oct 11, 2016 Reply

    Thank you so much, running fine on MB1,1 Bodhi Linux. I can finally use this in a library!

Leave a comment