/fan-control

Simple shell script to control hdd and cpu fans of macs in linux

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Linux on mac fan control

Note: This script has been primary coded for my iMac 12,1 (2011, 21.5 inch) and was later updated to work as well on the following macs: MacBook 5,1 and 5,2 running Ubuntu 20.04 and Macmini 3,1 (2009 Macmini), if you have problems with this script on other Macs please open an issue

Usage:

Option A

(here you don't create the actual command, just an alias, but it's more updatable, just git pull will get the job done)

  1. Clone the repo in home
cd ~/ && git clone https://github.com/juampapo546/fan-control/
  1. Create the alias for this script
    If you use bash :
echo  'alias fan="sudo sh /home/$USER/fan-control/fan.sh"' >> ~/.bashrc

If you use zsh :

echo  'alias fan="sudo sh /home/$USER/fan-control/fan.sh"' >> ~/.zshrc

If you have doubts you probably use bash, to be sure check if you have in your /home .bashrc or .zshrc


Option B

(here you create the command but you'll have to repeat the whole process every time you want to update)

  1. Clone the repo in home
cd ~/ && git clone https://github.com/juampapo546/fan-control/
  1. Move the script to /bin and make it executable
sudo mv ~/fan-control/fan.sh /bin/fan && sudo chmod +x /bin/fan 
  1. (optional) Clean remainings of the repo
rm -rf ~/fan-control 

Run fan!

First check what fans are available for your mac

fan

Then choose one one of the output fans and run:

sudo fan [ SELECT FAN TO CONTROL ] [SELECT THE PERCENTAGE YOU WANT THE FAN TO RUN ] 

	-hdd (an example)		-value (nummber from 1 to 100)  
	-auto				-auto 	 

For example if you want cpu fan to run at it's 65% the input should be:

sudo fan cpu 65