Skip to content

Instantly share code, notes, and snippets.

@gsora
Last active November 18, 2015 16:02
Show Gist options
  • Select an option

  • Save gsora/dc52c6f88a3de1e3ede9 to your computer and use it in GitHub Desktop.

Select an option

Save gsora/dc52c6f88a3de1e3ede9 to your computer and use it in GitHub Desktop.
Toggle between automatic and max fan speed on Retina MacBook Pros
#!/bin/bash
SMC=/sys/devices/platform/applesmc.*
MANUAL_VAL=$(cat $SMC/fan1_manual)
MANUAL=$SMC/fan1_manual
MIN=$(cat $SMC/fan1_min)
MAX=$(cat $SMC/fan1_max)
FOUT=$SMC/fan1_output
if [[ $UID != 0 ]]; then
echo "Run this script as root."
else
if [[ $MANUAL_VAL == 0 ]]; then
echo 1 > $MANUAL
echo $MAX > $FOUT
else
echo 0 > $MANUAL
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment