Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.rugarciap.DisableTurboBoost</string>
<key>OnDemand</key>
<false/>
<key>UserName</key>
<string>root</string>
<key>GroupName</key>
<string>wheel</string>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/tb</string>
<string>--sync</string>
</array>
</dict>
</plist>
#!/bin/bash
# Simple script that reuses kernel extension that comes with "Turbo Boost Switcher" app
# to toggle Turbo Boost. Place this script into /usr/local/bin.
#
# Kernel extension will be unloaded automatically after restart or long sleep.
# To apply current state on startup place "com.rugarciap.DisableTurboBoost.plist" file
# into "/Library/LaunchDaemons" and then load it with:
# sudo launchctl load /Library/LaunchDaemons/com.rugarciap.DisableTurboBoost.plist
# To apply current state on wake up install sleepwatcher:
# brew install sleepwatcher
# brew services start sleepwatcher
# And then add "tb --sync" command into /usr/local/etc/sleepwatcher/rc.wakeup
path="/Applications/Turbo Boost Switcher.app/Contents/Resources"
kextPath="$path/DisableTurboBoost.64bits.kext"
disabledPath="$path/disabled"
function printStatus {
result=$(kextstat | grep com.rugarciap.DisableTurboBoost)
if [ -z "$result" ]; then
echo "Turbo Boost ENABLED"
else
echo "Turbo Boost DISABLED"
fi
}
function disable {
# Loading kernel extension to disable TB
sudo kextutil "$kextPath" 2>/dev/null
}
function enable {
# Unloading kernel extension to re-enable TB
sudo kextunload "$kextPath" 2>/dev/null
}
if [ "$1" == "--off" ]; then
disable
echo 1 > "$disabledPath"
printStatus
elif [ "$1" == "--on" ]; then
enable
echo 0 > "$disabledPath"
printStatus
elif [ "$1" == "--check" ]; then
printStatus
elif [ "$1" == "--sync" ]; then
flag=$(cat "$disabledPath")
if [ "$flag" == "1" ]; then
echo "Turbo Boost is set to be disabled. Disabling."
disable
else
echo "Turbo Boost is set to be enabled. Enabling."
enable
fi
printStatus
else
echo "Invalid argument, should be --off, --on or --check"
exit 1
fi
Simple script to toggle Turbo Boost on MacBook Pro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment