Skip to content

Instantly share code, notes, and snippets.

@gretel
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gretel/7b3666c13ac6612938c1 to your computer and use it in GitHub Desktop.
Save gretel/7b3666c13ac6612938c1 to your computer and use it in GitHub Desktop.
configure_osx.sh
#!/bin/sh
#
# shamelessly ripped off https://github.com/bucaran/darwin/blob/master/darwin - thanks!
# TODO: integrate in https://github.com/gretel/lubrick
echo "Disable the sound effects on boot"
sudo nvram SystemAudioVolume=" "
echo "Set sidebar icon size to small"
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
echo "Show scrollbars only when scrolling"
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling"
echo "Increase window resize speed for Cocoa applications"
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
echo "Save to disk (not to iCloud) by default"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
echo "Remove duplicates in the 'Open With' menu"
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister \
-kill -r -domain local -domain system -domain user
echo "Set Help Viewer windows to non-floating mode"
defaults write com.apple.helpviewer DevMode -bool true
echo "Show IP address, hostname, OS version... on clicking the clock at login"
sudo defaults write /Library/Preferences/com.apple.loginwindow \
AdminHostInfo HostName
#echo "Restart automatically if the computer freezes"
#sudo systemsetup -setrestartfreeze on
echo "Check for software updates daily, not just once per week"
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
echo "Disable local Time Machine snapshots"
sudo tmutil disablelocal
echo "Disable the sudden motion sensor as it's not useful for SSDs"
sudo pmset -a sms 0
echo "Enable tap to click for this user and for the login screen"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
echo "Tap with two fingers to emulate right click"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad \
TrackpadRightClick -bool true
echo "Increase sound quality for Bluetooth headphones/headsets"
defaults write com.apple.BluetoothAudioAgent \
"Apple Bitpool Min (editable)" -int 40
#echo "Enable full keyboard access for all controls"
#defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
#echo "Use scroll gesture with the Ctrl (^) modifier key to zoom"
#defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
#defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
#echo "Follow the keyboard focus while zoomed in"
#defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
#echo "Disable press-and-hold for keys in favor of key repeat"
#defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
#echo "Set a blazingly fast keyboard repeat rate"
#defaults write NSGlobalDomain KeyRepeat -int 0
echo "Disable auto-correct"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
echo "Save screenshots to the desktop"
defaults write com.apple.screencapture location -string "$HOME/Desktop"
echo "Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)"
defaults write com.apple.screencapture type -string "png"
echo "Disable shadow in screenshots"
defaults write com.apple.screencapture disable-shadow -bool true
echo "Disable window animations and Get Info animations"
defaults write com.apple.finder DisableAllAnimations -bool true
echo "Set HOME as the default location for new Finder windows"
defaults write com.apple.finder NewWindowTarget -string "PfDe"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
echo "Allow text selection in Quick Look"
defaults write com.apple.finder QLEnableTextSelection -bool true
echo "Display full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo "When performing a search, search the current folder by default"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Disable the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
echo "Show File Extensions"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "Enable spring loading for directories"
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
echo "Remove the spring loading delay for directories"
defaults write NSGlobalDomain com.apple.springing.delay -float 0
echo "Avoid creating .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
#echo "Disable disk image verification"
#defaults write com.apple.frameworks.diskimages skip-verify -bool true
#defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
#defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
echo "Automatically open a new Finder window when a volume is mounted or not"
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool false
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool false
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
echo "Disable the warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
#echo "Empty Trash securely by default"
#defaults write com.apple.finder EmptyTrashSecurely -bool true
echo "Set the icon size of Dock items to 24 pixels"
defaults write com.apple.dock tilesize -int 24
echo "Change minimize/maximize window effect"
defaults write com.apple.dock mineffect -string "scale"
echo "Minimize windows into their application's icon"
defaults write com.apple.dock minimize-to-application -bool true
echo "Enable spring loading for all Dock items"
defaults write com.apple.dock enable-spring-load-actions-on-all-items \
-bool true
echo "Show indicator lights for open applications in the Dock"
defaults write com.apple.dock show-process-indicators -bool true
#echo "Wipe all (default) app icons from the Dock"
#defaults write com.apple.dock persistent-apps -array
echo "Don't animate opening applications from the Dock"
defaults write com.apple.dock launchanim -bool false
echo "Speed up Mission Control animations"
defaults write com.apple.dock expose-animation-duration -float 0.1
echo "Disable Dashboard"
defaults write com.apple.dashboard mcx-disabled -bool true
echo "Don't show Dashboard as a Space"
defaults write com.apple.dock dashboard-in-overlay -bool true
echo "Don't automatically rearrange Spaces based on most recent use"
defaults write com.apple.dock mru-spaces -bool false
echo "Remove the auto-hiding Dock delay"
defaults write com.apple.dock autohide-delay -float 0
echo "Remove the animation when hiding/showing the Dock"
defaults write com.apple.dock autohide-time-modifier -float 0
#echo "Automatically hide and show the Dock"
#defaults write com.apple.dock autohide -bool true
#echo "Top right screen corner → Mission Control"
#defaults write com.apple.dock wvous-tr-corner -int 2
#defaults write com.apple.dock wvous-tr-modifier -int 0
#echo "Bottom right screen corner → Desktop"
#defaults write com.apple.dock wvous-br-corner -int 4
#defaults write com.apple.dock wvous-br-modifier -int 0
echo "Disable continuous spell checking in Safari"
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool false
echo "Don't send search queries to Apple"
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
echo "Press Tab to highlight each item on a web page"
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
#echo "Show the full URL in the address bar (note: this still hides the scheme)"
#defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
echo "Set Safari's home page to 'about:blank' for faster loading"
defaults write com.apple.Safari HomePage -string "about:blank"
echo "Prevent Safari from opening ‘safe' files automatically after downloading"
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
#echo "Hide Safari's bookmarks bar by default"
#defaults write com.apple.Safari ShowFavoritesBar -bool false
#echo "Hide Safari's sidebar in Top Sites"
#defaults write com.apple.Safari ShowSidebarInTopSites -bool false
echo "Disable Safari's thumbnail cache for History and Top Sites"
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
echo "Enable Safari's debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
echo "Remove useless icons from Safari's bookmarks bar"
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
echo "Enable the Develop menu and the Web Inspector in Safari"
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari \
WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari \
com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled \
-bool true
echo "Add a context menu item for showing the Web Inspector in web views"
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
echo "Enable Web Inspector in Dictionary.app"
defaults write com.apple.Dictionary \
WebKitDeveloperExtras -bool true
echo "Disable send and reply animations in Mail.app"
defaults write com.apple.mail DisableReplyAnimations -bool true
defaults write com.apple.mail DisableSendAnimations -bool true
echo "Copy email addresses as 'foo@example.com' instead of 'Foo Bar <foo@example.com>' in Mail.app"
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
echo "Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app"
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
echo "Display emails in threaded mode, sorted by date (oldest at the top)"
defaults write com.apple.mail DraftsViewerAttributes \
-dict-add "DisplayInThreadedMode" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes \
-dict-add "SortedDescending" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes \
-dict-add "SortOrder" -string "received-date"
echo "Disable automatic spell checking"
defaults write com.apple.mail SpellCheckingBehavior \
-string "NoSpellCheckingEnabled"
echo "Show the main window when launching Activity Monitor"
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
echo "Visualize CPU usage in the Activity Monitor Dock icon"
defaults write com.apple.ActivityMonitor IconType -int 5
echo "Show all processes in Activity Monitor"
defaults write com.apple.ActivityMonitor ShowCategory -int 0
echo "Use plain text mode for new TextEdit documents"
defaults write com.apple.TextEdit RichText -int 0
echo "Open and save files as UTF-8 in TextEdit"
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
echo "Enable the WebKit Developer Tools in the Mac App Store"
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
echo "Enable Debug Menu in the Mac App Store"
defaults write com.apple.appstore ShowDebugMenu -bool true
echo "Disable continuous spell checking"
defaults write com.apple.messageshelper.MessageController \
SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" \
-bool false
echo "Only use UTF-8 in Terminal.app"
defaults write com.apple.terminal StringEncodings -array 4
echo "Patched fonts for Powerline users."
fonts_dir="$HOME/Library/Fonts"
powerline=$(mktemp -d $HOME/XXXX)
# Ready for some powerline fontgastic with awesome?
git clone "https://github.com/powerline/fonts" $powerline
find $powerline -name "*.[o,t]tf" | while read font
do
cp "$font" "$fonts_dir"
done
rm -rf $powerline
echo "All fonts installed to '$fonts_dir'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment