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.

make
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.

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.

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.

About the author

dgraziotin

Dr. Daniel Graziotin is a senior researcher (Akademischer Rat) at the University of Stuttgart, Germany. His research interests include human, behavioral, and psychological aspects of empirical software engineering, studies of science, and open science. He is associate editor at the Journal of Open Research Software and academic editor at the Research Ideas and Outcomes (RIO) journal. Daniel was awarded an Alexander von Humboldt Fellowship for postdoctoral researchers in 2017, the European Design Award (bronze) in 2016, and the Data Journalism Award in 2015. He received his Ph.D. in computer science at the Free University of Bozen-Bolzano, Italy.

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.

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.

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.

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!

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

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.

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.

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!

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.”

Incase anyone else has this problem, I found a solution
just clonel it from git:
sudo git clone https://github.com/dgraziotin/mbpfan
then do as normal
sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service
worked for me

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.

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.

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.

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’

On my MacBook Air 2012, with kernel 4.8 (Ubuntu 16.10, Fedora 25, Solus, Apricity OS) the fan is not as silent anymore. It is more often on. Like annoying. Was working better on earlier kernel, like 4.4 LTS. Not perfect as in MacOS, but really better than with latest kernel.

I suspect that there is something going on, e.g., more CPU utilization on your Air than before.

There have not been commits to the Linux kernel that are of interest to mbpfan since 2015 (proof: applesmc and coretemp). So, unless they changed something in how the CPU gets throttled (or something similar), nothing related to the kernel is causing malfunctions to mbpfan. Also in that case there would be little I could do, because I rely on applesmc and coretemp modules only.

I’ve been runing Ubuntu 16.10 (kernel 4.8.x) for the past 3 days. The only things I add were TLP and edited the modules with applesmc and coretemp. I wanted to try without mbpfan, to see how it goes. Not sure if I’m living dangerously, but my MacBook Air 2012 doesn’t seem to be hotter than on MacOS and is as silent. The fan seems to only come on when needed. Maybe the newer kernel helps.

Hey Daniel, thank you so much for taking your time on this small, but useful, piece of program and these wonderful instructions for us, lazy lads.
Tell you what, I’ve this MBP 7,1 from early 2010 and was struggling with his temperature. Not even macfanctld managed that. So I tried installing your program and everything went great, but I’ve got the same fan speed for both min and max. Is this odd or did I messed up on anything? Went down on this entire comment section and found no one with the same problem as me.
Thank you in advance. It’s working anyway I guess.

Installed 1.9.1 on Fedora 24 using this guide and tar – Mid-2010 Mackbook pro 15 inch (6,2 I believe?)
Tried to source build, but had problems. I think the apt-get install build-essential command just needs to be replaced with sudo dnf install gcc-c++ for fedora 24…

Hello and thanks for this precise tutorial, it is very clear and simple to follow.
Unfortunately in my case it did not do what I needed, maybe someone has a similar issue:
I have an iMac mid2011 with Ubuntu installed (no iOs at all), and changed the HDD into SSD. Now the fan nr.2 starts rising more and more up untill it reaches aprox. 5.500. This machine has 3 fans and nr.2 is missing the signal from the HDD. I have tryed to name them in the mbpfan.conf like:
min_fan1_speed = 1299
max_fan1_speed = 6199
min_fan2_speed = 1299
max_fan2_speed = 6199
and give them different values, but no reaction, even if I use the normal version without giving nr. to the fan, the mbpfan doesnt seem to cause any changes.
Anyone who could help here please? Thanks in advance!

Thanks! after having upgraded my ldme I couldn’t literally listen to any music or watch film due to noisy fan. Purged macfanctld and install and configured mbpfan. I lower the min_fan1_speed to one “bearable” and done!

After macfanctld would not reduce the fan speed from 5500 RPM no matter what I tried, I considered writing my own daemon. But then I found mbpfan and it works great so far. Running on a Mac Mini 1,1 with the 2,1 EFI firmware hack.

Thanks for this program.
I am currently running Fedora 25 on a 2013 MBP 15″
when running the tests in verbose mode, I get:

Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.0.15 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp
Found 5 sensors
Found 2 fans
Using new sensor path for kernel >= 3.0.15 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp
Found 5 sensors
Couldn’t open configfile, using defaults
polling_interval is not 1
Tests run: 5

Since I’d really like to run my laptop a lot colder than the default, this poses a bit of a problem.
I have tried running chmod 777 on /etc/mbpfan.conf but this hasn’t solved the problem.

Sorry to bother you with this, but I can’t seem to figure out the problem.

I was able to run the steps on using vi editor although gedit was successfully installed… also I saw the on the first line output the /usr/sbin/mbpfan -fv. I would just like to know how come my laptop is still having more than warm temperature compared when using my regular MacOS system? I have only installed openssh, build essentials and gedit… also installed xauth since I really want gedit to work…. Please help if anything I still need to do?

You can tweak the system config to lower high_temp. Mbpfan will kick in earlier. Other than that, mbpfan will not mimic macOS fan system. The reason is that we do not know how macOS manages the fans. The algorithm is proprietary.

Is it a normal behavior that everytime my ubuntu/mac laptop reboots, I need to enable the mbpfan service all over again? Is there something I can do that the service is automatically starting once I reboot?

followed all of these steps however even after reboot, the fan ran for about 1 minute then shut off. Running ps aux | grep mbpfan did not reveal a line ending in mbpfan -fv, but you don’t specify what to do if that is the case. What should I do to fix this?

Hi. i have installed mbfan but when i run tests on my macbook 2,1 i have this:
make[1]: uscita dalla directory “/home/patato/Scaricati/mbpfan-2.0.2”
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp
Found 0 sensors
mbpfan could not detect any temp sensor. Please contact the developer.
make: *** [tests] Errore 1

Successfully installed the tool on my 27″ iMac mid 2010 i5. I had Windows 7 and Lubuntu 16.04 running along with OS X on this machine without any fan issues. But since I recently had to swap the logicboard the fan control is broken. This Mac has three fans with different minimum speeds. I wonder if I can set the minimum speed to the lowesst level of all three fans.

Actually, it does not work fully. The tool is working with two of the fans, HDD at 2000rmp and CPU with 940rpm. But the Optical Disk fan ist blowing at full speed now, 3500rpm. This is sad, because the original problem was that HDD and CPU fans were running wild and the Optical Disk fan was slow by the motherboard itself. 😀

Always had heat/shutdown problems with my 27inch imac even with xos installed. Only use it now as a media player with mint18 xfce, but still overheating shutdown was a problem.
This is the best fan control I’ve come across, either for xos or linux (which, as I don’t have a hight level of geekiness, often I couldn’t get to work on a mac). I set quiet fan from 50 to 60, then aggressive 60 to 70 (as in all my monitoring prior to installing mbpfan never saw 72+ so shutdown happening about there (maybe faulty temp readings)).
mpdfan is quieter than anything I’ve tried – even when over 60 – and cured shutdowns.
Thanks 🙂

Tried to install the program on my 2009 macbook pro and got to running “sudo make tests”, receiving an error.

Log from the command:

make[1]: Leaving directory ‘/home/pommaq/Downloads/mbpfan-2.1.0’
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp
Found 2 sensors
Found 1 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp
Found 2 sensors
Could not read min_fan_speed from config file

Tests run: 4

Was told to contact you if I received any error, so here I am. Should I be worried?
Running Enso Os 0.3 (I believe it is based on Ubuntu 18.4 or something)

I suppose it works but I’m unable to run “sudo make tests” as it appears everytime I do run it, it runs “sudo make installs” first, resetting the config file.
Tough it’s logical those settings being commented is the cause for the errors. Thanks!

Thanks to developers for this. Experiencing no more constant high fan speed on MBP 2,1 :

Did not get All Tests Passed when building latest version so used one before last which built and installed.
After reboot, fans worked slower than before but produced intermittent bursts which were annoying. Eventually uninstalled macfanctld (which did not work to correct speeds), after which getting a quite mac and waiting for it to start cooling when the temperature reaches threshold. So far so good.

A configuration file has been copied (might overwrite existing file) to /etc/mbpfan.conf.
See README.md file to have mbpfan automatically started at system boot.

Please run the tests now with the command
sudo make tests

make[1]: Verzeichnis „/home/andreas/Downloads/mbpfan-2.1.0“ wird verlassen
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp
Found 2 sensors
Found 3 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp
Found 2 sensors
Could not read min_fan_speed from config file
Tests run: 4
andreas@Mate-iMac:~/Downloads/mbpfan-2.1.0$

make[1]: Leaving directory ‘/home/mharvell/Downloads/mbpfan-master’
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp
Found 5 sensors
Found 2 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp
Found 5 sensors
Error: Invalid Higher temp test (if fan was already spinning high, this is not worrying)
Tests run: 3
Makefile:39: recipe for target ‘tests’ failed

make[1]: Leaving directory ‘/home/ace/Downloads/mbpfan-2.1.0’
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp
Found 2 sensors
Found 3 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp
Found 2 sensors
Could not read min_fan_speed from config file
Tests run: 4

make[1]: Leaving directory '/home/ace/Downloads/mbpfan-2.1.0'
/usr/sbin/mbpfan -f -v -t
Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp
Found 2 sensors
Found 3 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp
Found 2 sensors
Could not read min_fan_speed from config file
Tests run: 4

Could NOT READ MIN_FAN_SPEED.. fans still whirring.. though i heard a slight pause during system reboot

Hi, i try this , and i didn’t pass the test. It shows that Starting the tests..
It is normal for them to take a bit to finish.
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp
Found 3 sensors
Found 1 fans
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp
Found 3 sensors
Could not read min_fan_speed from config file
Tests run: 4
so please help me to fix this problem, thanks.

[…] embarking on these steps, be aware that the author has taken care to write a little guide in English here. The second thing to know is that the values you will have in the next step are dependent on your […]

I followed everything you said and read the comments, but I still don’t know what to do. The command `ps aux | grep mbpfan` doesn’t return a line ending with `/usr/sbin/mbpfan`, only `paradym+ 2027 0.0 0.0 5304 876 pts/1 S+ 23:20 0:00 grep –color=auto mbpfan`. I tried what worked for Aelevision with no success.

Hi Daniel,
I know that this is a really old post that I am unearthing but I wanted to let you know that you really helped me with this.
I have an old (2011) iMac that I have tried Ubuntu, Manjaro and Pop OS (Ubuntu) on and each time the fans were running at their max. I found various guides on the internet for various utilities that I followed but nothing seemed to work but I was also always too busy to dig into it.
Right now I am home sick, so of course instead of resting I’m bored and trying to fix things that have been long standing and I came across your guide.
It was absolutely perfect for what I needed and your utility has saved my sanity. Right now the computer is so quiet that it is unbelievable.
So I just wanted to say thank you for the guide and for mbpfan!

This likely isn’t as much about mbpfan as it is about *my* particular MacBook Pro. As folks may or not know, the MacBook Pro line in 2011 is prone to a Radeon video card decline and eventual failure. Some enterprising folks found a way to hack the emi (that through linux, interestingly) and then *permanently* hardware hack the Radeon card (via a 30 sec operation removing a small resister). This puts a cooler-running, though not as video card laden, MacBook. It means Linux installs easily w/ no need to worry about emi issues.

HOWEVER! Fans are screaming on it. I *think* using mbpfan is not working correctly due to my hardware hack (perhaps some of the heat sensors were disabled when the card was disabled). So my problem is how to get the machine to stop throttling up and down with the fans (I messed w/ the mbpfan config file in various ways, but with no results.)

So… maybe that’s just a report because no one has any ideas. Or maybe someone here (including the author) has an idea for me. I’d sure appreciate it.

Just swapped my HDD for an SSD on my iMac 12.1 mid 2011 & the fans went crazy as I didn’t modify the SATA power cable or use the OWC ‘temp sensor’ cable as it is way too expensive for me. I have just installed mbpfan using Dr. Graziotin’s excellent guide, rebooted and my iMac is as quiet as a mouse; thank you SO much 🙂

Just installed (H Sierra dual boot Ubuntu Mate 18.04.4 LTS) on iMac late 2009. Spent a heap of time trying to find fan controller through the maze (WEB). I think your nifty bit of software is the answer. Seams to work like a charm will see how it goes over the next few months. At least I can here that the fan is running (the machine was getting to hot running ubuntu). Will also be trying it out on Mac book pro 5,5 mid 2009 also 4 boot system (Snow Leopard, El Capitan, H Sierra Patcher, Mojave patcher & possibly 18.04.4 ubuntu mate). Ps your tutorial very was good although I had to get my son to help as he is very tech savvy & I’m out of practice cd dir & the like (pre msdos days Commodore 64). Baz 2020-03-28 well done. I have a beer for you.

Thank you for your helpful guide. But I still have a problem with the fan of my iMac9.1. Sadly the fan of the ODD (DVD drive) runs on maximum speed, since I changed the drive against a SSD drive some years ago. At that time I was using Mac OS. The problem is known for this computer, but apple never changed the problem. The program Macs Fan Control fixed the problem. When I changed to LINUX Mint 19.3 MATE 1.22.2 the problem came up again. I tried to fix it with mbpfan, but it didn’t work till now.
When I use the programm Psensor it showes the following values:

About Author

dgraziotin

Dr. Daniel Graziotin is a senior researcher (Akademischer Rat) at the University of Stuttgart, Germany. His research interests include human, behavioral, and psychological aspects of empirical software engineering, studies of science, and open science. He is associate editor at the Journal of Open Research Software and academic editor at the Research Ideas and Outcomes (RIO) journal. Daniel was awarded an Alexander von Humboldt Fellowship for postdoctoral researchers in 2017, the European Design Award (bronze) in 2016, and the Data Journalism Award in 2015. He received his Ph.D. in computer science at the Free University of Bozen-Bolzano, Italy.