Skip to content

Instantly share code, notes, and snippets.

@NickCrew
Created January 24, 2022 20:29
Show Gist options
  • Save NickCrew/405afb9a78d14bd34164329bdd854e6c to your computer and use it in GitHub Desktop.
Save NickCrew/405afb9a78d14bd34164329bdd854e6c to your computer and use it in GitHub Desktop.
macOS Sane Defaults
#!/usr/bin/env zsh
#
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepWindows -bool false
# Disable crash reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Enable subpixel font rendering on non-Apple LCDs
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
# Finder: show path bar
defaults write com.apple.finder ShowPathbar -boolean true
# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -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
# Show the ~/Library folder
chflags nohidden ~/Library
# Enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Group windows by application in Mission Control
defaults write com.apple.dock expose-group-by-app -bool true
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Set 1 second delay when showing and hiding the Dock (to discourage using the Dock)
defaults write com.apple.dock autohide-delay -float 1
# 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
# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# Enable the WebKit Developer Tools in the Mac App Store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# Copy email addresses as `[email protected]` instead of `Foo Bar <[email protected]>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\\U21a9"
# Make every attachment you send act like an attachment instead of a pretty unusable decoration
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -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
for app in "Address Book" "Calendar" "Contacts" "Dashboard" "Dock" "Finder" \
"Mail" "Safari" "SystemUIServer" "Terminal" "iCal" "iTunes" "NotificationCenter"; do
killall "$app" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment