Skip to content

Instantly share code, notes, and snippets.

@BobbyRyterski
Last active August 29, 2015 14:14
Show Gist options
  • Save BobbyRyterski/096c2566ca486649d25c to your computer and use it in GitHub Desktop.
Save BobbyRyterski/096c2566ca486649d25c to your computer and use it in GitHub Desktop.
Mac GPU switching fix
#!/usr/bin/env bash
# https://gist.github.com/BobbyRyterski/096c2566ca486649d25c
# save your battery, fix settings for apps that default to use the discrete gpu
# http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macoutlook/office-for-mac-mavericks-high-performance-gpu/e1a6aff0-e36e-40ae-ab62-aa7e3e0c6b10
# http://blog.her.se/2014/03/increase-battery-performance-in-your.html
fix_app_gpu_defaults() {
[[ -d "$1" ]] || { echo "App not found: $1" >&2; return 1; }
defaults write "$1/Contents/Info.plist" 'NSSupportsAutomaticGraphicsSwitching' -bool true
if [[ $? -eq 0 ]]; then
chmod 664 "$1/Contents/Info.plist"
codesign -f --verbose --deep -s - "$1/"
else
echo "Fix failed for app: $1" >&2
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment