Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Created December 13, 2011 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterhellberg/1472799 to your computer and use it in GitHub Desktop.
Save peterhellberg/1472799 to your computer and use it in GitHub Desktop.
Control the fan speed of the Macbook Air
#!/bin/sh
smc=/Applications/smcFanControl.app/Contents/Resources/smc
min_hex=$(python -c "print hex("2000" << 2)[2:]")
max_hex=$(python -c "print hex("6500" << 2)[2:]")
${smc} -k F0Mn -w ${min_hex}
${smc} -k F0Mx -w ${max_hex}
# Control the fan speed of the Macbook Air
# NOTE: Don’t complain if you melt your computer.
function set_fan_speed {
if [ -z "$1" ]; then min_speed=2000; else min_speed=$1; fi
if [ -z "$2" ]; then max_speed=6500; else max_speed=$2; fi
smc=/Applications/smcFanControl.app/Contents/Resources/smc
min_hex=$(python -c "print hex("$min_speed" << 2)[2:]")
max_hex=$(python -c "print hex("$max_speed" << 2)[2:]")
${smc} -k F0Mn -w ${min_hex}
${smc} -k F0Mx -w ${max_hex}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment