From 1b1dcc6d311b7d93a99567dd248239b1782a2bfa Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 8 Apr 2016 03:35:51 +0100 Subject: [PATCH] Sane OS X defaults --- osx.sh | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100755 osx.sh diff --git a/osx.sh b/osx.sh new file mode 100755 index 0000000..7f9c8e0 --- /dev/null +++ b/osx.sh @@ -0,0 +1,155 @@ +#!/usr/bin/env zsh + +# Ask for the admin password upfront +sudo -v + +# Keep the sudo session alive +while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & + +## General UI/UX +# Expand save panel by default +defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true +defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true + +# Expand print panel by default +defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true +defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true + +# Automatically quit printer app once the print jobs complete +defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true + +# Disable the “Are you sure you want to open this application?” dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false + +# Reveal IP address, hostname, OS version, etc. when clicking the clock +# in the login window +sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName + +# Check for software updates daily, not just once per week +defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 + +# Set language and text formats +defaults write NSGlobalDomain AppleLanguages -array "en" +defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=GBP" +defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" +defaults write NSGlobalDomain AppleMetricUnits -bool true + +# Set the timezone; see `sudo systemsetup -listtimezones` for other values +sudo systemsetup -settimezone "Europe/London" > /dev/null + +# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) +defaults write com.apple.screencapture type -string "png" + +# Finder: show all filename extensions +defaults write NSGlobalDomain AppleShowAllExtensions -bool true + +# Display full POSIX path as Finder window title +defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + +# When performing a search, search the current folder by default +defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" + +# Disable the warning when changing a file extension +defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false + +# Avoid creating .DS_Store files on network volumes +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + +# Disable the warning before emptying the Trash +defaults write com.apple.finder WarnOnEmptyTrash -bool false + +# Show the ~/Library folder +chflags nohidden ~/Library + +# Show the /Volumes folder +sudo chflags nohidden /Volumes + +## Dock and Dashboard +# Change minimize/maximize window effect +defaults write com.apple.dock mineffect -string "genie" + +# Minimize windows into their application’s icon +defaults write com.apple.dock minimize-to-application -bool true + +# Show indicator lights for open applications in the Dock +defaults write com.apple.dock show-process-indicators -bool true + +# Don’t automatically rearrange Spaces based on most recent use +defaults write com.apple.dock mru-spaces -bool false + +# Remove the auto-hiding Dock delay +defaults write com.apple.dock autohide-delay -float 0 +# Remove the animation when hiding/showing the Dock +defaults write com.apple.dock autohide-time-modifier -float 0 + +# Automatically hide and show the Dock +defaults write com.apple.dock autohide -bool true + +## Safari and Webkit +# Privacy: don’t send search queries to Apple +defaults write com.apple.Safari UniversalSearchEnabled -bool false +defaults write com.apple.Safari SuppressSearchSuggestions -bool true + +# Set Safari’s home page to `about:blank` for faster loading +defaults write com.apple.Safari HomePage -string "about:blank" + +# Prevent Safari from opening ‘safe’ files automatically after downloading +defaults write com.apple.Safari AutoOpenSafeDownloads -bool false + +# Allow hitting the Backspace key to go to the previous page in history +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true + +# Enable Safari’s debug menu +defaults write com.apple.Safari IncludeInternalDebugMenu -bool true + +## Terminal & iTerm2 +# Only use UTF-8 in Terminal.app +defaults write com.apple.terminal StringEncodings -array 4 + +# Don’t display the annoying prompt when quitting iTerm +defaults write com.googlecode.iterm2 PromptOnQuit -bool false + +## Time Machine +# Prevent Time Machine from prompting to use new hard drives as backup volume +defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true + +## Activity Monitor +# Show the main window when launching Activity Monitor +defaults write com.apple.ActivityMonitor OpenMainWindow -bool true + +# Visualize CPU usage in the Activity Monitor Dock icon +defaults write com.apple.ActivityMonitor IconType -int 5 + +# Show all processes in Activity Monitor +defaults write com.apple.ActivityMonitor ShowCategory -int 0 + +## Address Book, TextEdit, and Disk Utility +# Enable the debug menu in Address Book +defaults write com.apple.addressbook ABShowDebugMenu -bool true + +# Use plain text mode for new TextEdit documents +defaults write com.apple.TextEdit RichText -int 0 +# 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 + +# Enable the debug menu in Disk Utility +defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true +defaults write com.apple.DiskUtility advanced-image-options -bool true + +## Mac App Store +# Enable the WebKit Developer Tools in the Mac App Store +defaults write com.apple.appstore WebKitDeveloperExtras -bool true + +# Enable Debug Menu in the Mac App Store +defaults write com.apple.appstore ShowDebugMenu -bool true + +## Photos +# Prevent Photos from opening automatically when devices are plugged in +defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true + +## Tweetbot +# Bypass the annoyingly slow t.co URL shortener +defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true + +echo "Updated preferences, some changes may need a restart"