Skip to content

Instantly share code, notes, and snippets.

@autodidacticon
Created April 30, 2015 19:19
Show Gist options
  • Save autodidacticon/a1e35042051d5b5b3577 to your computer and use it in GitHub Desktop.
Save autodidacticon/a1e35042051d5b5b3577 to your computer and use it in GitHub Desktop.
gpu_fix.sh
#!/usr/bin/env bash
# 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
}
apps=('/Applications/Microsoft Lync.app' \
'/Applications/Microsoft Office 2011/Microsoft Outlook.app' \
'/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app' \
'/Applications/Aventail Connect.app')
for app in "${apps[@]}"; do
echo "Fixing ${app##*/}"
fix_app_gpu_defaults "$app"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment