2016-08-31 07:45:05 +00:00
mbpfan
2012-06-09 14:40:12 +00:00
====================
Introduction
---------------------
2012-08-23 20:32:49 +00:00
This is an enhanced version of [Allan McRae mbpfan ](http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/ )
2012-06-09 14:25:28 +00:00
2016-08-31 07:45:05 +00:00
mbpfan is a daemon that uses input from coretemp module and sets the fan speed using the applesmc module.
2012-06-09 14:25:28 +00:00
This enhanced version assumes any number of processors and fans (max. 10).
2012-06-11 19:43:53 +00:00
* It only uses the temperatures from the processors as input.
* It requires coretemp and applesmc kernel modules to be loaded.
* It requires root use
2012-07-03 08:39:30 +00:00
* It daemonizes or stays in foreground
* Verbose mode for both syslog and stdout
2012-08-22 13:05:52 +00:00
* Users can configure it using the file /etc/mbpfan.conf
2012-06-09 14:25:28 +00:00
2012-08-23 09:08:17 +00:00
Supported GNU/Linux Distributions
---------------------------------
We provide scripts to to load mbpfan daemon at system boot for many distros.
2012-10-20 15:18:30 +00:00
Please note that the support is provided by volunteers. mbpfan needs tests and bug reports.
2012-08-23 09:08:17 +00:00
Supported distributions:
- Ubuntu
- Debian
2013-10-13 16:18:17 +00:00
- Archlinux
2012-08-23 09:08:17 +00:00
- Fedora
- RedHat
- CentOS
- Gentoo
2017-03-27 15:44:34 +00:00
- Alpine
- Trisquel
2012-08-23 09:08:17 +00:00
Tested Macbook Models
2012-06-09 14:40:12 +00:00
---------------------
2014-05-14 07:14:26 +00:00
This section reports those models where mbpfan was tested successfully. It does not necessarily mean that the daemon does not work on non-listed models.
2015-12-20 15:22:52 +00:00
- MacBook Pro 12,1 13" (Intel i5 - Linux 4.20)
2014-06-21 17:35:56 +00:00
- MacBook Pro 11,1 13" (Intel i5 - Linux 3.14, Linux 3.15)
2013-10-13 16:18:17 +00:00
- MacBook Pro 9,2 13" (Intel i5/i7 - Linux 3.10)
2014-06-23 09:00:18 +00:00
- MacBook Pro 8,2 15" (Intel i7 - Linux 3.6.2)
2012-10-24 20:37:53 +00:00
- MacBook Pro 8,1 13" (Intel i7 - Linux 3.2.0)
2014-06-23 09:00:18 +00:00
- MacBook Pro 7,1 15" (Intel Core 2 Duo - Linux 3.13)
- MacBook Pro 6,2 15" (Intel i7 - Linux 3.5.0)
2012-10-24 20:37:53 +00:00
- MacBook Pro 6,2 15" (Intel i7 - Linux 3.2.0)
2012-08-23 09:08:17 +00:00
- MacBook Pro 2,2 15" (Intel Core 2 Duo - Linux 3.4.4)
2016-10-11 11:43:20 +00:00
- MacBook Air 5,2 13" (Intel i5 - Linux 3.16)
2016-12-27 22:20:08 +00:00
- MacBook Air 1,1 13" (Intel Core Duo - Linux 4.4, Linux 4.8)
2016-02-25 10:37:08 +00:00
- MacBook 1,1 (Intel Core Duo - Linux 3.16)
2012-08-23 09:08:17 +00:00
2016-07-12 08:50:11 +00:00
Tested iMac/Mini Models
2015-08-31 02:04:01 +00:00
------------------
2016-07-21 12:01:47 +00:00
This section reports the iMac/Mac-mini models where mbpfan was tested successfully.
2015-08-31 02:04:01 +00:00
2016-08-31 07:45:05 +00:00
- iMac Retina 16.2 21.5" (Intel i5 - Linux 4.4.0 Ubuntu 16.04)
2016-07-21 12:01:47 +00:00
- iMac 12,1 21.5" (Intel i7 - Linux 4.6.4)
2016-07-21 11:37:52 +00:00
- iMac 5,1 17" (Intel T7400 (Core 2 Duo) - Linux 14.04 Ubuntu)
2016-07-12 08:50:11 +00:00
- Mac Mini 2,1 (Core 2 Duo - Linux 4.4.0)
2017-01-16 00:46:47 +00:00
- Mac Mini 5,3 (Core i7 2.0 - Linux 4.4.0 elementary/Ubuntu)
2016-09-13 08:03:12 +00:00
- Mac Mini 6,1 (Core i7 2.3 - Linux 4.7.3-4-ck Archlinux)
2012-06-09 14:40:12 +00:00
2012-08-23 09:08:17 +00:00
Warning
-------
Be sure to load the kernel modules **applesmc** and **coretemp** .
2015-02-08 08:42:25 +00:00
These modules are often automatically loaded when booting up GNU/Linux on a Macbook. If that is not the case, you should make sure to load them at system startup. This is _usually_ achieved by inserting the following two lines in the file `/etc/modules`
```
coretemp
applesmc
```
2012-08-23 09:08:17 +00:00
2015-02-08 08:42:25 +00:00
Please check the relevant documentation of your GNU/Linux distribution.
2012-08-23 09:08:17 +00:00
2013-10-13 16:27:52 +00:00
Arch Linux
---------
See [mbpfan-git at AUR ](https://aur.archlinux.org/packages/mbpfan-git/ ).
Otherwise, please refer to the Generic Instructions.
Ubuntu
------
Install the ```build-essential``` package.
Then, refer to the Generic Install Instructions.
2016-01-30 16:36:45 +00:00
Otherwise, a step-by-step [tutorial for beginners is available on my website ](https://ineed.coffee/3838/a-beginners-mbpfan-tutorial-for-ubuntu/ ).
2016-03-31 16:12:35 +00:00
Gentoo
------
Type the following command to add the overlay
sudo layman -a andjscott
Then install it
sudo emerge -av mbpfan
2013-10-13 16:27:52 +00:00
2016-12-28 16:40:21 +00:00
2013-10-13 16:27:52 +00:00
Generic Install Instructions
-------------------------
2012-06-09 14:25:28 +00:00
Compile with
2012-08-23 09:08:17 +00:00
make
2012-06-09 14:40:12 +00:00
2012-06-15 19:12:51 +00:00
Install with
2012-06-15 19:47:23 +00:00
2012-08-23 09:08:17 +00:00
sudo make install
2012-06-15 19:47:23 +00:00
2016-12-28 16:40:21 +00:00
It copies mbpfan to /usr/sbin, mbpfan.conf to /etc (and overwrites existing files),
2016-08-31 07:45:05 +00:00
README.md to /usr/share/doc/mbpfan, and mbpfan.8.gz to /usr/share/man/man8
2012-06-15 19:47:23 +00:00
2016-12-28 16:40:21 +00:00
Run the tests now, see two sections below.
2017-03-19 17:54:29 +00:00
If you would like to compile with Clang instead of GCC, simply set your system's
default compiler to be Clang (tested with Clang 3.8)
2016-12-28 16:40:21 +00:00
2012-06-15 19:12:51 +00:00
2012-08-22 13:05:52 +00:00
Run The Tests (Recommended)
---------------------------
2016-03-17 10:11:23 +00:00
It is recommended to run the tests after installing the program. Please run the following command _from within the source directory_ .
2012-07-31 17:09:20 +00:00
2012-08-23 09:08:17 +00:00
sudo ./bin/mbpfan -t
2012-08-22 13:05:52 +00:00
or
2012-06-09 14:25:28 +00:00
2012-08-23 09:08:17 +00:00
sudo make tests
2012-08-22 13:05:52 +00:00
2012-06-15 19:12:51 +00:00
2012-06-09 14:40:12 +00:00
Run Instructions
2012-08-22 13:05:52 +00:00
----------------
2012-06-15 19:47:23 +00:00
If not installed, run with
2012-08-23 09:08:17 +00:00
sudo bin/mbpfan
2012-06-09 14:40:12 +00:00
2012-06-15 19:47:23 +00:00
If installed, manually run with
2012-08-23 09:08:17 +00:00
sudo mbpfan
2012-06-15 19:47:23 +00:00
If installed and using the init file, run with (Ubuntu example)
2012-08-23 09:08:17 +00:00
sudo service mbpfan start
2012-06-15 19:47:23 +00:00
2012-08-22 13:05:52 +00:00
Starting at boot
----------------
2012-08-22 13:53:07 +00:00
**Ubuntu**
2016-05-02 09:26:29 +00:00
For systemd based init systems (Ubuntu 16.04+), the file mbpfan.service
has been provided.
For using it, execute:
sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service
For upstart based init systems (Ubuntu before 16.04), an example upstart job has been provided.
For using it, execute:
2012-08-23 09:08:17 +00:00
sudo cp mbpfan.upstart /etc/init/mbpfan.conf
sudo start mbpfan
2012-08-22 13:53:07 +00:00
**Debian**
An init file suitable for /lib/lsb/init-functions (Debian)
2012-08-22 13:05:52 +00:00
is located in the main folder of the source files, called mbpfan.init.debian
Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
and move it to /etc/init.d
2012-08-23 09:08:17 +00:00
Then, add it to the default runlevels with (as root):
sudo update-rc.d mbpfan defaults
2012-08-22 13:05:52 +00:00
2012-08-22 13:53:07 +00:00
**Redhat, CentOS, Fedora**
An init file suitable for /etc/rc.d/init.d/functions
2012-08-22 13:05:52 +00:00
(RHEL/CentOS & Fedora) is also located at the same place, this file is called
mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions
and move it to /etc/init.d
To add the script to the default runlevels, run the following as root:
2012-08-23 09:08:17 +00:00
chkconfig --level 2345 mbpfan on & & chkconfig --level 016 mbpfan off
**Gentoo**
To automatically run mbpfan at boot, run as root:
rc-update add mbpfan default
2012-08-22 13:05:52 +00:00
2012-08-22 13:53:07 +00:00
**systemd**
2012-08-22 13:05:52 +00:00
As a special bonus, a service file for systemd is also included. To use it,
2012-08-23 09:08:17 +00:00
execute the following (as root):
2015-10-22 12:33:30 +00:00
sudo cp mbpfan.service /etc/systemd/system/
2016-03-17 10:15:16 +00:00
sudo systemctl enable mbpfan.service
2012-08-23 09:08:17 +00:00
sudo systemctl daemon-reload
sudo systemctl start mbpfan.service
2012-08-22 13:53:07 +00:00
2012-08-22 13:05:52 +00:00
To start the service automatically at boot, also execute the following:
2012-08-23 09:08:17 +00:00
sudo systemctl enable mbpfan.service
2012-08-22 13:05:52 +00:00
2012-07-03 08:39:30 +00:00
Usage
-------
2012-08-23 09:08:17 +00:00
Usage: ./mbpfan OPTION(S)
-h Show the help screen
-f Run in foreground
-t Run the tests
-v Be (a lot) verbose
2012-07-03 08:39:30 +00:00
2012-06-09 14:40:12 +00:00
License
---------------------
GNU General Public License version 3
2012-06-09 14:25:28 +00:00
2012-01-25 15:26:01 +00:00
2012-06-09 14:40:12 +00:00
Based On
---------------------
2012-06-11 19:43:53 +00:00
* http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/
* http://allanmcrae.com/2011/08/mbp-fan-daemon-update/
* https://launchpad.net/macfanctld
* http://paste2.org/p/862259
2013-10-13 16:18:17 +00:00
* http://www.lobotomo.com/products/FanControl/