A simple daemon to control fan speed on all MacBook/MacBook Pros (probably all Apple computers) for Linux Kernel 3 and newer
Find a file
2024-02-18 15:30:56 -06:00
.github feat: deploy dockerfile & ci 2023-07-19 08:18:15 -05:00
src fix: clan 16 warnings 2024-02-18 15:30:56 -06:00
tests fix: clan 16 warnings 2024-02-18 15:30:56 -06:00
.gitignore Added Eclipse project files to .gitignore 2012-07-05 01:06:40 +02:00
.travis.yml Add Travis configuration. 2019-01-18 11:55:30 -08:00
AUTHORS Add testing of Mac Pro models to README. Ref Issue #140 and (incidentally) #167 2019-01-22 18:26:29 -08:00
COPYING Create COPYING 2016-02-07 13:44:30 +01:00
Dockerfile chore: change to distroless 2024-01-15 16:21:57 -06:00
Makefile Ensure lib/modules-load.d exists before installing there 2022-11-20 06:51:37 +09:00
mbpfan.8.gz Moved tests to separate binary (mbpfan-tests) 2020-05-19 23:06:27 +09:00
mbpfan.conf Improve comments in the config around {low,high,max}_temp settings 2021-03-02 21:40:10 +09:00
mbpfan.conf.test0 Change default polling_interval to 1 2019-01-18 11:34:07 -08:00
mbpfan.conf.test1 Use smaller max_fan_speed in tests 2020-04-30 19:27:04 +09:00
mbpfan.conf.test2 Change default polling_interval to 1 2019-01-18 11:34:07 -08:00
mbpfan.depend.conf Add coretemp as module dependency at startup 2022-08-14 10:25:57 +09:00
mbpfan.dinit Create dinit service definition, update readme to include dinit instructions 2022-04-03 21:33:21 +09:00
mbpfan.init.debian Fixes #18. Seems ready for v1.4.0 2012-08-23 22:32:49 +02:00
mbpfan.init.gentoo [Fix #98] runscript-> openrc-run gentoo init 2016-12-29 19:03:10 +01:00
mbpfan.init.redhat Fixes #18. Seems ready for v1.4.0 2012-08-23 22:32:49 +02:00
mbpfan.service Fix PIDFile= reference, restart latency in systemd service 2022-11-06 14:19:51 -07:00
mbpfan.spec Removed autoconfig with suggested procedure because has been integrated on mbpfan. Commented auto detect values from config file. 2018-09-11 03:09:35 +05:30
mbpfan.upstart Change upstart to respawn forever 2013-10-13 12:05:00 +02:00
README.md Create dinit service definition, update readme to include dinit instructions 2022-04-03 21:33:21 +09:00

mbpfan

Build Status

This is an enhanced version of Allan McRae mbpfan

mbpfan is a daemon that uses input from coretemp module and sets the fan speed using the applesmc module. This enhanced version assumes any number of processors and fans (max. 10).

  • It only uses the temperatures from the processors as input.
  • It requires coretemp and applesmc kernel modules to be loaded.
  • It requires root use
  • It daemonizes or stays in foreground
  • Verbose mode for both syslog and stdout
  • Users can configure it using the file /etc/mbpfan.conf

Table Of Contents

Supported GNU/Linux Distributions

We provide scripts to to load mbpfan daemon at system boot for many distros. Please note that the support is provided by volunteers. mbpfan needs tests and bug reports.

Supported distributions:

  • Ubuntu
  • Debian
  • Archlinux
  • Fedora
  • RedHat
  • CentOS
  • Gentoo
  • Alpine
  • Trisquel
  • Solus

Tested Mac Models

See https://github.com/linux-on-mac/mbpfan/wiki/Tested-Mac-Models .

Requirements

Be sure to load the kernel modules applesmc and coretemp.

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.

How do I know if applesmc and coretemp are loaded?

In most distributions, you can run the following command:

lsmod | grep -e applesmc -e coretemp

If you see coretemp and applesmc listed, you are all set.

If you do not see coretemp and applesmc listed, you must load them.

This is usually achieved by inserting the following two lines in the file /etc/modules

coretemp
applesmc

Please check the relevant documentation of your GNU/Linux distribution.

Installation

Arch Linux

See mbpfan-git at AUR. Otherwise, please refer to the Generic Instructions.

CRUX Linux

Follow the instructions on jolupalabs REPO for installation.

Debian

On Debian 10 or later install via:

sudo apt-get install mbpfan

Fedora

On Fedora 30 or later:

sudo dnf install mbpfan

Gentoo

Install the mbpfan package with:

sudo emerge -av app-laptop/mbpfan

Solus

On Solus, install the package with:

sudo eopkg install mbpfan

then enable the service.

Ubuntu

On Ubuntu 18.04 or later install via:

sudo apt-get install mbpfan

Generic Install Instructions (All Other Operating Systems)

Compile with

make

Install with

sudo make install

It copies mbpfan to /usr/sbin, mbpfan.conf to /etc (and overwrites existing files), README.md to /usr/share/doc/mbpfan, and mbpfan.8.gz to /usr/share/man/man8

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 and 3.9. Tested with Clang 4.0 along with llvm-lld (The LLVM Linker).

Run The Tests (Optional)

Users may run the tests after building the program. Please run the following command from within the source directory.

sudo make tests

Note that this only works on MacBook and not desktop computers due to different environment expectations.

Run Instructions

If not installed, run with

sudo bin/mbpfan

If installed, manually run with

sudo mbpfan

If installed and using the init file, run with (Ubuntu example)

sudo service mbpfan start

Starting at boot

Ubuntu

For systemd based init systems (Ubuntu 16.04+), see the systemd section below.

For upstart based init systems (Ubuntu before 16.04), an example upstart job has been provided. For using it, execute:

sudo cp mbpfan.upstart /etc/init/mbpfan.conf
sudo start mbpfan

Debian An init file suitable for /lib/lsb/init-functions (Debian) 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 Then, add it to the default runlevels with (as root):

sudo update-rc.d mbpfan defaults

Redhat, CentOS, Fedora An init file suitable for /etc/rc.d/init.d/functions (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:

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

systemd As a special bonus, a service file for systemd is also included. To use it, execute the following (as root):

sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service
sudo systemctl daemon-reload
sudo systemctl start mbpfan.service

dinit A dinit service definition is also included. To use it, execute the following:

sudo cp mbpfan.dinit /etc/dinit.d/mbpfan
sudo dinitctl enable mbpfan
sudo dinitctl start mbpfan

Usage

Usage: ./mbpfan OPTION(S)

-h Show the help screen
-f Run in foreground
-v Be (a lot) verbose

References

License

GNU General Public License version 3

Credits

This Project Is Based On:

This Project uses following library: