Skip to content

Instantly share code, notes, and snippets.

@cHolzberger
Last active August 29, 2015 14:25
Show Gist options
  • Save cHolzberger/dd7c9bc558334876a523 to your computer and use it in GitHub Desktop.
Save cHolzberger/dd7c9bc558334876a523 to your computer and use it in GitHub Desktop.
MacOS X - VM Optimizations
echo "Fix LoginBackground"
mv /System/Library/CoreServices/DefaultDesktop.jpg /System/Library/CoreServices/DefaultDesktop.jpg.orig
echo "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEWAdnEYKLmAAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg" | base64 -D -o /System/Library/CoreServices/DefaultDesktop.jpg
chflangs uchg /System/Library/CoreServices/DefaultDesktop.jpg
echo "Disable Animations"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO
echo "Disable Mail Animations"
defaults write com.apple.Mail DisableReplyAnimations -bool YES
defaults write com.apple.Mail DisableSendAnimations -bool YES
echo "Disable Mission Control Animations"
defaults write com.apple.dock expose-animation-duration -int 0; killall Dock
echo "Disable Launchpad Animations"
defaults write com.apple.dock springboard-show-duration -int 0
defaults write com.apple.dock springboard-hide-duration -int 0
echo "Expanding the save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
echo ""
echo "Disable smart quotes and smart dashes"
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
echo ""
echo "Disable hibernation (speeds up entering sleep mode)"
sudo pmset -a hibernatemode 0
sudo pmset -a disksleep 0
sudo pmset -a lidwake 0
echo ""
echo "Remove the sleep image file to save disk space"
sudo rm /Private/var/vm/sleepimage
echo "Creating a zero-byte file instead"
sudo touch /Private/var/vm/sleepimage
echo "and make sure it can't be rewritten"
sudo chflags uchg /Private/var/vm/sleepimage
echo "Disable the sudden motion sensor"
sudo pmset -a sms 0
echo "Disable the menubar transparency? "
defaults write com.apple.universalaccess reduceTransparency -bool true
echo "Disable atime"
cat <<END_ATIME > /Library/LaunchDaemons/com.noatime.root.plist
<?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.noatime.root</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
<string>-uwo</string>
<string>noatime</string>
<string>/</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
END_ATIME
echo ""
echo "Disabling press-and-hold for special keys in favor of key repeat"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
echo ""
echo "Setting a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 0
echo "Display full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo ""
echo "Speeding up Mission Control animations and grouping windows by application"
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock "expose-group-by-app" -bool true
echo "Disable local Time Machine backups? "
hash tmutil &> /dev/null && sudo tmutil disablelocal
echo ""
echo ""
cecho "################################################################################" $white
echo ""
echo ""
cecho "Note that some of these changes require a logout/restart to take effect." $red
cecho "Killing some open applications in order to take effect." $red
echo ""
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \
"Terminal" "Transmission"; do
killall "${app}" > /dev/null 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment