From ccb3828572b85d942475250ea39ac6e27a593350 Mon Sep 17 00:00:00 2001 From: Kevin Suttle Date: Thu, 3 Aug 2017 11:02:30 -0400 Subject: [PATCH] Update to ref: 398496c https://github.com/mathiasbynens/dotfiles/commit/398496c2372d65c0e6770d02b0c5b49c0d636f31 --- .macos | 215 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 163 insertions(+), 52 deletions(-) diff --git a/.macos b/.macos index 5ddd93a..e213db6 100755 --- a/.macos +++ b/.macos @@ -2,6 +2,10 @@ # ~/.macos — https://mths.be/macos +# Close any open System Preferences panes, to prevent them from overriding +# settings we’re about to change +osascript -e 'tell application "System Preferences" to quit' + # Ask for the administrator password upfront sudo -v @@ -27,19 +31,6 @@ sudo nvram SystemAudioVolume=" " # Disable transparency in the menu bar and elsewhere on Yosemite defaults write com.apple.universalaccess reduceTransparency -bool true -# Menu bar: hide the Time Machine, Volume, and User icons -for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do - defaults write "${domain}" dontAutoLoad -array \ - "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ - "/System/Library/CoreServices/Menu Extras/Volume.menu" \ - "/System/Library/CoreServices/Menu Extras/User.menu" -done -defaults write com.apple.systemuiserver menuExtras -array \ - "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ - "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ - "/System/Library/CoreServices/Menu Extras/Battery.menu" \ - "/System/Library/CoreServices/Menu Extras/Clock.menu" - # Set highlight color to green defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" @@ -50,6 +41,9 @@ defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 defaults write NSGlobalDomain AppleShowScrollBars -string "Always" # Possible values: `WhenScrolling`, `Automatic` and `Always` +# Disable the over-the-top focus ring animation +defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false + # Disable smooth scrolling # (Uncomment if you’re on an older Mac that messes up the animation) #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false @@ -108,18 +102,24 @@ sudo systemsetup -setrestartfreeze on # Never go into computer sleep mode sudo systemsetup -setcomputersleep Off > /dev/null -# Check for software updates daily, not just once per week -defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 - # Disable Notification Center and remove the menu bar icon launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null -# Disable smart quotes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false +# Disable automatic capitalization as it’s annoying when typing code +defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false # Disable smart dashes as they’re annoying when typing code defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false +# Disable automatic period substitution as it’s annoying when typing code +defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false + +# Disable smart quotes as they’re annoying when typing code +defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false + +# Disable auto-correct +defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. #rm -rf ~/Library/Application Support/Dock/desktoppicture.db @@ -130,9 +130,6 @@ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false # SSD-specific tweaks # ############################################################################### -# Disable local Time Machine snapshots -sudo tmutil disablelocal - # Disable hibernation (speeds up entering sleep mode) sudo pmset -a hibernatemode 0 @@ -143,9 +140,6 @@ sudo touch /private/var/vm/sleepimage # …and make sure it can’t be rewritten sudo chflags uchg /private/var/vm/sleepimage -# Disable the sudden motion sensor as it’s not useful for SSDs -sudo pmset -a sms 0 - ############################################################################### # Trackpad, mouse, keyboard, Bluetooth accessories, and input # ############################################################################### @@ -181,7 +175,8 @@ defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false # Set a blazingly fast keyboard repeat rate -defaults write NSGlobalDomain KeyRepeat -int 0 +defaults write NSGlobalDomain KeyRepeat -int 1 +defaults write NSGlobalDomain InitialKeyRepeat -int 10 # Set language and text formats # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with @@ -191,12 +186,12 @@ defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR" defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" defaults write NSGlobalDomain AppleMetricUnits -bool true +# Show language menu in the top right corner of the boot screen +sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true + # Set the timezone; see `sudo systemsetup -listtimezones` for other values sudo systemsetup -settimezone "Europe/Brussels" > /dev/null -# Disable auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false - # Stop iTunes from responding to the keyboard media keys #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null @@ -218,7 +213,8 @@ defaults write com.apple.screencapture type -string "png" defaults write com.apple.screencapture disable-shadow -bool true # Enable subpixel font rendering on non-Apple LCDs -defaults write NSGlobalDomain AppleFontSmoothing -int 2 +# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 +defaults write NSGlobalDomain AppleFontSmoothing -int 1 # Enable HiDPI display modes (requires restart) sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true @@ -256,12 +252,12 @@ defaults write com.apple.finder ShowStatusBar -bool true # Finder: show path bar defaults write com.apple.finder ShowPathbar -bool true -# Finder: allow text selection in Quick Look -defaults write com.apple.finder QLEnableTextSelection -bool true - # Display full POSIX path as Finder window title defaults write com.apple.finder _FXShowPosixPathInTitle -bool true +# Keep folders on top when sorting by name +defaults write com.apple.finder _FXSortFoldersFirst -bool true + # When performing a search, search the current folder by default defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" @@ -274,8 +270,9 @@ defaults write NSGlobalDomain com.apple.springing.enabled -bool true # Remove the spring loading delay for directories defaults write NSGlobalDomain com.apple.springing.delay -float 0 -# Avoid creating .DS_Store files on network volumes +# Avoid creating .DS_Store files on network or USB volumes defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true +defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true # Disable disk image verification defaults write com.apple.frameworks.diskimages skip-verify -bool true @@ -317,18 +314,15 @@ defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" # Disable the warning before emptying the Trash defaults write com.apple.finder WarnOnEmptyTrash -bool false -# Empty Trash securely by default -defaults write com.apple.finder EmptyTrashSecurely -bool true - # Enable AirDrop over Ethernet and on unsupported Macs running Lion defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true -# Enable the MacBook Air SuperDrive on any Mac -sudo nvram boot-args="mbasd=1" - # Show the ~/Library folder chflags nohidden ~/Library +# Show the /Volumes folder +sudo chflags nohidden /Volumes + # Remove Dropbox’s green checkmark icons in Finder file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns [ -e "${file}" ] && mv -f "${file}" "${file}.bak" @@ -367,6 +361,9 @@ defaults write com.apple.dock show-process-indicators -bool true # the Dock to launch apps. #defaults write com.apple.dock persistent-apps -array +# Show only open applications in the Dock +#defaults write com.apple.dock static-only -bool true + # Don’t animate opening applications from the Dock defaults write com.apple.dock launchanim -bool false @@ -403,8 +400,9 @@ defaults write com.apple.dock showhidden -bool true # Reset Launchpad, but keep the desktop wallpaper intact find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete -# Add iOS Simulator to Launchpad -sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app" "/Applications/iOS Simulator.app" +# Add iOS & Watch Simulator to Launchpad +sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" +sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" # Add a spacer to the left side of the Dock (where the applications are) #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' @@ -483,6 +481,44 @@ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebK # Add a context menu item for showing the Web Inspector in web views defaults write NSGlobalDomain WebKitDeveloperExtras -bool true +# Enable continuous spellchecking +defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true +# Disable auto-correct +defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false + +# Disable AutoFill +defaults write com.apple.Safari AutoFillFromAddressBook -bool false +defaults write com.apple.Safari AutoFillPasswords -bool false +defaults write com.apple.Safari AutoFillCreditCardData -bool false +defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false + +# Warn about fraudulent websites +defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true + +# Disable plug-ins +defaults write com.apple.Safari WebKitPluginsEnabled -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false + +# Disable Java +defaults write com.apple.Safari WebKitJavaEnabled -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false + +# Block pop-up windows +defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false + +# Disable auto-playing video +#defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false +#defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false +#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false +#defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false + +# Enable “Do Not Track” +defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true + +# Update extensions automatically +defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true + ############################################################################### # Mail # ############################################################################### @@ -495,7 +531,7 @@ defaults write com.apple.mail DisableSendAnimations -bool true 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" -string "@\\U21a9" +defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9" # Display emails in threaded mode, sorted by date (oldest at the top) defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" @@ -519,7 +555,7 @@ defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnab # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" # Change indexing order and disable some search results -# Yosemite-specific search results (remove them if your are using OS X 10.9 or older): +# Yosemite-specific search results (remove them if you are using macOS 10.9 or older): # MENU_DEFINITION # MENU_CONVERSION # MENU_EXPRESSION @@ -615,6 +651,13 @@ EOD #defaults write com.apple.terminal FocusFollowsMouse -bool true #defaults write org.x.X11 wm_ffm -bool true +# Enable Secure Keyboard Entry in Terminal.app +# See: https://security.stackexchange.com/a/47786/8918 +defaults write com.apple.terminal SecureKeyboardEntry -bool true + +# Disable the annoying line marks +defaults write com.apple.Terminal ShowLineMarks -int 0 + # Install the Solarized Dark theme for iTerm open "${HOME}/init/Solarized Dark.itermcolors" @@ -671,6 +714,9 @@ defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true defaults write com.apple.DiskUtility advanced-image-options -bool true +# Auto-play videos when opened with QuickTime Player +defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true + ############################################################################### # Mac App Store # ############################################################################### @@ -681,6 +727,34 @@ defaults write com.apple.appstore WebKitDeveloperExtras -bool true # Enable Debug Menu in the Mac App Store defaults write com.apple.appstore ShowDebugMenu -bool true +# Enable the automatic update check +defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true + +# Check for software updates daily, not just once per week +defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 + +# Download newly available updates in background +defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 + +# Install System data files & security updates +defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 + +# Automatically download apps purchased on other Macs +defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 + +# Turn on app auto-update +defaults write com.apple.commerce AutoUpdate -bool true + +# Allow the App Store to reboot machine on macOS updates +defaults write com.apple.commerce AutoUpdateRestartRequired -bool true + +############################################################################### +# Photos # +############################################################################### + +# Prevent Photos from opening automatically when devices are plugged in +defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true + ############################################################################### # Messages # ############################################################################### @@ -698,10 +772,6 @@ defaults write com.apple.messageshelper.MessageController SOInputLineSettings -d # Google Chrome & Google Chrome Canary # ############################################################################### -# Allow installing user scripts via GitHub Gist or Userscripts.org -defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" -defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" - # Disable the all too sensitive backswipe on trackpads defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false @@ -758,8 +828,15 @@ cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" +# Use `~/Downloads` to store completed downloads +defaults write org.m0k.transmission DownloadLocationConstant -bool true + # Don’t prompt for confirmation before downloading defaults write org.m0k.transmission DownloadAsk -bool false +defaults write org.m0k.transmission MagnetOpenAsk -bool false + +# Don’t prompt for confirmation before removing non-downloading active transfers +defaults write org.m0k.transmission CheckRemoveDownloading -bool true # Trash original torrent files defaults write org.m0k.transmission DeleteOriginalTorrent -bool true @@ -769,6 +846,15 @@ defaults write org.m0k.transmission WarningDonate -bool false # Hide the legal disclaimer defaults write org.m0k.transmission WarningLegal -bool false +# IP block list. +# Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ +defaults write org.m0k.transmission BlocklistNew -bool true +defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" +defaults write org.m0k.transmission BlocklistAutoUpdate -bool true + +# Randomize port on launch +defaults write org.m0k.transmission RandomPort -bool true + ############################################################################### # Twitter.app # ############################################################################### @@ -794,6 +880,13 @@ defaults write com.twitter.twitter-mac ShowFullNames -bool true # Hide the app in the background if it’s not the front-most window defaults write com.twitter.twitter-mac HideInBackground -bool true +############################################################################### +# Tweetbot.app # +############################################################################### + +# Bypass the annoyingly slow t.co URL shortener +defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true + ############################################################################### # Spectacle.app # ############################################################################### @@ -826,10 +919,28 @@ defaults write com.divisiblebyzero.Spectacle UndoLastMove -data 62706c6973743030 # Kill affected applications # ############################################################################### -for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ - "Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ - "Opera" "Safari" "SizeUp" "Spectacle" "SystemUIServer" "Terminal" \ - "Transmission" "Twitter" "iCal"; do - killall "${app}" > /dev/null 2>&1 +for app in "Activity Monitor" \ + "Address Book" \ + "Calendar" \ + "cfprefsd" \ + "Contacts" \ + "Dock" \ + "Finder" \ + "Google Chrome Canary" \ + "Google Chrome" \ + "Mail" \ + "Messages" \ + "Opera" \ + "Photos" \ + "Safari" \ + "SizeUp" \ + "Spectacle" \ + "SystemUIServer" \ + "Terminal" \ + "Transmission" \ + "Tweetbot" \ + "Twitter" \ + "iCal"; do + killall "${app}" &> /dev/null done echo "Done. Note that some of these changes require a logout/restart to take effect."