10_macos.sh (44425B)
1 #!/usr/bin/env bash 2 [[ "$(uname)" != "Darwin" ]] && return 1 3 4 read -p "Do you want to set macOS settings? [y/n] " -n 1 -r 5 [[ "$REPLY" == [Nn]* ]] && return 1 6 7 # Derived from mathiasbynens's macos setup script 8 9 # Close any open System Preferences panes, to prevent them from overriding 10 # settings we’re about to change 11 osascript -e 'tell application "System Preferences" to quit' 12 13 # Ask for the administrator password upfront 14 sudo -v 15 16 # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 17 while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 18 19 ############################################################################### 20 # General UI/UX # 21 ############################################################################### 22 23 # Set standby delay to 1 hour 24 sudo pmset -a standbydelay "$(echo "1*60*60"|bc)" 25 26 # Disable the sound effects on boot 27 sudo nvram SystemAudioVolume=" " 28 29 # Use dark theme 30 defaults write .GlobalPreferences AppleInterfaceStyle -string "Dark" 31 32 # (Do not) disable transparency 33 defaults write com.apple.universalaccess reduceTransparency -bool false 34 35 # Reduce motion animations 36 defaults write com.apple.universalaccess reduceMotion -bool true 37 38 # Set highlight color to gray 39 #defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 40 defaults write NSGlobalDomain AppleHighlightColor -string "0.750000 0.750000 0.750000" 41 42 # Set sidebar icon size to small 43 defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1 44 45 # Scrollbar preferences 46 defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" 47 # Possible values: `WhenScrolling`, `Automatic` and `Always` 48 49 # Disable the over-the-top focus ring animation 50 defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false 51 52 # Increase window resize speed for Cocoa applications 53 defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 54 55 # Expand save panel by default 56 defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 57 defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 58 59 # Expand print panel by default 60 defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 61 defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 62 63 # Save to disk (not to iCloud) by default 64 defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 65 66 # Automatically quit printer app once the print jobs complete 67 defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 68 69 # Disable the “Are you sure you want to open this application?” dialog 70 defaults write com.apple.LaunchServices LSQuarantine -bool false 71 72 # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 73 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 74 75 # Display ASCII control characters using caret notation in standard text views 76 # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 77 defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 78 79 # Disable Resume system-wide 80 defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 81 82 # Disable automatic termination of inactive apps 83 defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 84 85 # Disable the crash reporter 86 #defaults write com.apple.CrashReporter DialogType -string "none" 87 88 # Set Help Viewer windows to non-floating mode 89 defaults write com.apple.helpviewer DevMode -bool true 90 91 # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 92 # Commented out, as this is known to cause problems in various Adobe apps :( 93 # See https://github.com/mathiasbynens/dotfiles/issues/237 94 #echo "0x08000100:0" > ~/.CFUserTextEncoding 95 96 # Reveal IP address, hostname, OS version, etc. when clicking the clock 97 # in the login window 98 sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 99 100 # Restart automatically if the computer freezes 101 sudo systemsetup -setrestartfreeze on 102 103 # Never go into computer sleep mode 104 #sudo systemsetup -setcomputersleep Off > /dev/null 105 106 # Disable Notification Center and remove the menu bar icon 107 launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 108 109 # Disable automatic capitalization as it’s annoying when typing code 110 defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 111 112 # Disable smart dashes as they’re annoying when typing code 113 defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 114 115 # Disable automatic period substitution as it’s annoying when typing code 116 defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 117 118 # Disable smart quotes as they’re annoying when typing code 119 defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 120 121 # Disable auto-correct 122 defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 123 124 # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 125 # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 126 #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 127 #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 128 #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 129 130 ############################################################################### 131 # SSD-specific tweaks # 132 ############################################################################### 133 134 # Disable hibernation (speeds up entering sleep mode) 135 #sudo pmset -a hibernatemode 0 136 137 # Remove the sleep image file to save disk space 138 #sudo rm /private/var/vm/sleepimage 139 # Create a zero-byte file instead… 140 #sudo touch /private/var/vm/sleepimage 141 # …and make sure it can’t be rewritten 142 #sudo chflags uchg /private/var/vm/sleepimage 143 144 ############################################################################### 145 # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 146 ############################################################################### 147 148 # Trackpad: enable tap to click for this user and for the login screen 149 defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 150 defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 151 defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 152 153 # Enable "natural" (Lion-style) scrolling 154 defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true 155 156 # Increase sound quality for Bluetooth headphones/headsets 157 defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 158 159 # Enable full keyboard access for all controls 160 # (e.g. enable Tab in modal dialogs) 161 defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 162 163 # Use scroll gesture with the Ctrl (^) modifier key to zoom 164 defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 165 defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 166 # Follow the keyboard focus while zoomed in 167 defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 168 169 # Disable press-and-hold for keys in favor of key repeat 170 #defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 171 defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true 172 173 # Set keyboard repeat rate (macOS defaults: 6 and 25) 174 defaults write NSGlobalDomain KeyRepeat -int 3 175 defaults write NSGlobalDomain InitialKeyRepeat -int 30 176 177 # Set language and text formats 178 # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 179 # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 180 defaults write NSGlobalDomain AppleLanguages -array "en" "da" 181 defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" 182 defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 183 defaults write NSGlobalDomain AppleMetricUnits -bool true 184 185 # Show language menu in the top right corner of the boot screen 186 sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true 187 188 # Set the timezone; see `sudo systemsetup -listtimezones` for other values 189 #sudo systemsetup -settimezone "Europe/Copenhagen" > /dev/null 190 sudo systemsetup -settimezone "America/New_York" > /dev/null 191 192 # Stop iTunes from responding to the keyboard media keys 193 #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 194 195 ############################################################################### 196 # Screen # 197 ############################################################################### 198 199 # Require password immediately after sleep or screen saver begins 200 defaults write com.apple.screensaver askForPassword -int 1 201 defaults write com.apple.screensaver askForPasswordDelay -int 0 202 203 # Save screenshots to the desktop 204 defaults write com.apple.screencapture location -string "${HOME}/Desktop" 205 206 # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 207 defaults write com.apple.screencapture type -string "png" 208 209 # Disable shadow in screenshots 210 defaults write com.apple.screencapture disable-shadow -bool true 211 212 # Enable subpixel font rendering on non-Apple LCDs 213 # Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 214 defaults write NSGlobalDomain AppleFontSmoothing -int 2 215 defaults write com.apple.Terminal AppleFontSmoothing -int 0 216 217 # Enable HiDPI display modes (requires restart) 218 sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 219 220 ############################################################################### 221 # Finder # 222 ############################################################################### 223 224 # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 225 defaults write com.apple.finder QuitMenuItem -bool true 226 227 # Finder: disable window animations and Get Info animations 228 defaults write com.apple.finder DisableAllAnimations -bool true 229 230 # Set Desktop as the default location for new Finder windows 231 # For other paths, use `PfLo` and `file:///full/path/here/` 232 #defaults write com.apple.finder NewWindowTarget -string "PfDe" 233 #defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 234 235 # Set Home as the default location for new Finder windows 236 defaults write com.apple.finder NewWindowTarget -string "PfHm" 237 defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" 238 239 # Show icons for hard drives, servers, and removable media on the desktop 240 defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false 241 defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 242 defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 243 defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 244 245 # Finder: show hidden files by default 246 #defaults write com.apple.finder AppleShowAllFiles -bool true 247 248 # Finder: show all filename extensions 249 defaults write NSGlobalDomain AppleShowAllExtensions -bool true 250 251 # Finder: show status bar 252 defaults write com.apple.finder ShowStatusBar -bool true 253 254 # Finder: show path bar 255 defaults write com.apple.finder ShowPathbar -bool true 256 257 # Display full POSIX path as Finder window title 258 defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 259 260 # Keep folders on top when sorting by name 261 defaults write com.apple.finder _FXSortFoldersFirst -bool true 262 263 # When performing a search, search the current folder by default 264 defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 265 266 # Disable the warning when changing a file extension 267 defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 268 269 # Enable spring loading for directories 270 defaults write NSGlobalDomain com.apple.springing.enabled -bool true 271 272 # Remove the spring loading delay for directories 273 defaults write NSGlobalDomain com.apple.springing.delay -float 0 274 275 # Avoid creating .DS_Store files on network or USB volumes 276 defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 277 defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 278 279 # Disable disk image verification 280 #defaults write com.apple.frameworks.diskimages skip-verify -bool true 281 #defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 282 #defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 283 284 # Automatically open a new Finder window when a volume is mounted 285 defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 286 defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 287 defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 288 289 # Show item info near icons on the desktop and in other icon views 290 #/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 291 #/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 292 #/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 293 294 # Show item info to the right of the icons on the desktop 295 #/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 296 297 # Enable snap-to-grid for icons on the desktop and in other icon views 298 /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 299 /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 300 /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 301 302 # Increase grid spacing for icons on the desktop and in other icon views 303 /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 304 /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 305 /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 306 307 # Increase the size of icons on the desktop and in other icon views 308 #/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 309 #/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 310 #/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 311 312 # Use list view in all Finder windows by default 313 # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 314 defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 315 316 # Disable the warning before emptying the Trash 317 defaults write com.apple.finder WarnOnEmptyTrash -bool false 318 319 # Enable AirDrop over Ethernet and on unsupported Macs running Lion 320 defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 321 322 # Show the ~/Library folder 323 chflags nohidden ~/Library 324 325 # Show the /Volumes folder 326 sudo chflags nohidden /Volumes 327 328 # Remove Dropbox’s green checkmark icons in Finder 329 file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 330 [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 331 332 # Expand the following File Info panes: 333 # “General”, “Open with”, and “Sharing & Permissions” 334 defaults write com.apple.finder FXInfoPanesExpanded -dict \ 335 General -bool true \ 336 OpenWith -bool true \ 337 Privileges -bool true 338 339 ############################################################################### 340 # Dock, Dashboard, and hot corners # 341 ############################################################################### 342 343 # Enable highlight hover effect for the grid view of a stack (Dock) 344 defaults write com.apple.dock mouse-over-hilite-stack -bool true 345 346 # Set the icon size of Dock items to 36 pixels 347 defaults write com.apple.dock tilesize -int 36 348 349 # Change minimize/maximize window effect 350 defaults write com.apple.dock mineffect -string "scale" 351 352 # Minimize windows into their application’s icon 353 defaults write com.apple.dock minimize-to-application -bool true 354 355 # Enable spring loading for all Dock items 356 defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 357 358 # Show indicator lights for open applications in the Dock 359 defaults write com.apple.dock show-process-indicators -bool true 360 361 # Wipe all (default) app icons from the Dock 362 # This is only really useful when setting up a new Mac, or if you don’t use 363 # the Dock to launch apps. 364 #defaults write com.apple.dock persistent-apps -array 365 366 # Show only open applications in the Dock 367 #defaults write com.apple.dock static-only -bool true 368 369 # Don’t animate opening applications from the Dock 370 defaults write com.apple.dock launchanim -bool false 371 372 # Speed up Mission Control animations 373 defaults write com.apple.dock expose-animation-duration -float 0.1 374 375 # Don’t group windows by application in Mission Control 376 # (i.e. use the old Exposé behavior instead) 377 defaults write com.apple.dock expose-group-by-app -bool false 378 379 # Disable Dashboard 380 defaults write com.apple.dashboard mcx-disabled -bool true 381 382 # Don’t show Dashboard as a Space 383 defaults write com.apple.dock dashboard-in-overlay -bool true 384 385 # Don’t automatically rearrange Spaces based on most recent use 386 defaults write com.apple.dock mru-spaces -bool false 387 388 # Remove the auto-hiding Dock delay 389 defaults write com.apple.dock autohide-delay -float 0 390 # Remove the animation when hiding/showing the Dock 391 defaults write com.apple.dock autohide-time-modifier -float 0 392 393 # Automatically hide and show the Dock 394 defaults write com.apple.dock autohide -bool true 395 396 # Make Dock icons of hidden applications translucent 397 defaults write com.apple.dock showhidden -bool true 398 399 # Disable the Launchpad gesture (pinch with thumb and three fingers) 400 #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 401 402 # Reset Launchpad, but keep the desktop wallpaper intact 403 find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 404 405 # Add iOS & Watch Simulator to Launchpad 406 #sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 407 #sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" 408 409 # Add a spacer to the left side of the Dock (where the applications are) 410 #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 411 # Add a spacer to the right side of the Dock (where the Trash is) 412 #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 413 414 # Hot corners 415 # Possible values: 416 # 0: no-op 417 # 2: Mission Control 418 # 3: Show application windows 419 # 4: Desktop 420 # 5: Start screen saver 421 # 6: Disable screen saver 422 # 7: Dashboard 423 # 10: Put display to sleep 424 # 11: Launchpad 425 # 12: Notification Center 426 # Top left 427 defaults write com.apple.dock wvous-tl-corner -int 0 428 defaults write com.apple.dock wvous-tl-modifier -int 0 429 # Top right 430 defaults write com.apple.dock wvous-tr-corner -int 0 431 defaults write com.apple.dock wvous-tr-modifier -int 0 432 # Bottom left 433 defaults write com.apple.dock wvous-br-corner -int 0 434 defaults write com.apple.dock wvous-br-modifier -int 0 435 # Bottom right 436 defaults write com.apple.dock wvous-bl-corner -int 0 437 defaults write com.apple.dock wvous-bl-modifier -int 0 438 439 ############################################################################### 440 # Safari & WebKit # 441 ############################################################################### 442 443 # Privacy: don’t send search queries to Apple 444 defaults write com.apple.Safari UniversalSearchEnabled -bool false 445 defaults write com.apple.Safari SuppressSearchSuggestions -bool true 446 447 # Press Tab to highlight each item on a web page 448 defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 449 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 450 451 # Show the full URL in the address bar (note: this still hides the scheme) 452 defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 453 454 # Set Safari’s home page to `about:blank` for faster loading 455 defaults write com.apple.Safari HomePage -string "about:blank" 456 457 # Prevent Safari from opening ‘safe’ files automatically after downloading 458 defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 459 460 # Allow hitting the Backspace key to go to the previous page in history 461 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 462 463 # Hide Safari’s bookmarks bar by default 464 defaults write com.apple.Safari ShowFavoritesBar -bool false 465 466 defaults write com.apple.safari ShowOverlayStatusBar -int 1 467 468 # Hide Safari’s sidebar in Top Sites 469 defaults write com.apple.Safari ShowSidebarInTopSites -bool false 470 471 # Disable Safari’s thumbnail cache for History and Top Sites 472 defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 473 474 # Enable Safari’s debug menu 475 defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 476 477 # Make Safari’s search banners default to Contains instead of Starts With 478 defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 479 480 # Remove useless icons from Safari’s bookmarks bar 481 defaults write com.apple.Safari ProxiesInBookmarksBar "()" 482 483 # Enable the Develop menu and the Web Inspector in Safari 484 defaults write com.apple.Safari IncludeDevelopMenu -bool true 485 defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 486 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 487 488 # Add a context menu item for showing the Web Inspector in web views 489 defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 490 491 # Enable continuous spellchecking 492 defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true 493 # Disable auto-correct 494 defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false 495 496 # Disable AutoFill 497 #defaults write com.apple.Safari AutoFillFromAddressBook -bool false 498 #defaults write com.apple.Safari AutoFillPasswords -bool false 499 #defaults write com.apple.Safari AutoFillCreditCardData -bool false 500 #defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false 501 502 # Warn about fraudulent websites 503 defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true 504 505 # Disable plug-ins 506 defaults write com.apple.Safari WebKitPluginsEnabled -bool false 507 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false 508 509 # Disable Java 510 defaults write com.apple.Safari WebKitJavaEnabled -bool false 511 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false 512 513 # Block pop-up windows 514 defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false 515 defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false 516 517 # Disable auto-playing video 518 #defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false 519 #defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false 520 #defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 521 #defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 522 523 # Enable “Do Not Track” 524 defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true 525 526 # Update extensions automatically 527 defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true 528 529 # Use duckduckgo as search provider 530 defaults write com.apple.safari SearchProviderIdentifier 'com.duckduckgo' 531 532 ############################################################################### 533 # Mail # 534 ############################################################################### 535 536 # Disable send and reply animations in Mail.app 537 defaults write com.apple.mail DisableReplyAnimations -bool true 538 defaults write com.apple.mail DisableSendAnimations -bool true 539 540 # Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app 541 defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 542 543 # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 544 #defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9" 545 546 # Display emails in threaded mode, sorted by date (oldest at the top) 547 defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 548 defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 549 defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 550 551 # Disable inline attachments (just show the icons) 552 defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 553 554 # Disable automatic spell checking 555 defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 556 557 ############################################################################### 558 # Spotlight # 559 ############################################################################### 560 561 # Hide Spotlight tray-icon (and subsequent helper) 562 #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 563 # Disable Spotlight indexing for any volume that gets mounted and has not yet 564 # been indexed before. 565 # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 566 sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 567 # Change indexing order and disable some search results 568 # Yosemite-specific search results (remove them if you are using macOS 10.9 or older): 569 # MENU_DEFINITION 570 # MENU_CONVERSION 571 # MENU_EXPRESSION 572 # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 573 # MENU_WEBSEARCH (send search queries to Apple) 574 # MENU_OTHER 575 defaults write com.apple.spotlight orderedItems -array \ 576 '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 577 '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 578 '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 579 '{"enabled" = 1;"name" = "PDF";}' \ 580 '{"enabled" = 1;"name" = "FONTS";}' \ 581 '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 582 '{"enabled" = 0;"name" = "MESSAGES";}' \ 583 '{"enabled" = 0;"name" = "CONTACT";}' \ 584 '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 585 '{"enabled" = 0;"name" = "IMAGES";}' \ 586 '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 587 '{"enabled" = 0;"name" = "MUSIC";}' \ 588 '{"enabled" = 0;"name" = "MOVIES";}' \ 589 '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 590 '{"enabled" = 0;"name" = "SPREADSHEETS";}' 591 '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 592 '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 593 '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 594 '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 595 '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 596 # Load new settings before rebuilding the index 597 killall mds > /dev/null 2>&1 598 # Make sure indexing is enabled for the main volume 599 sudo mdutil -i on / > /dev/null 600 # Rebuild the index from scratch 601 sudo mdutil -E / > /dev/null 602 603 ############################################################################### 604 # Terminal & iTerm 2 # 605 ############################################################################### 606 607 # Only use UTF-8 in Terminal.app 608 defaults write com.apple.terminal StringEncodings -array 4 609 610 # Use a modified version of the Solarized Dark theme by default in Terminal.app 611 #osascript <<EOD 612 # 613 #tell application "Terminal" 614 # 615 # local allOpenedWindows 616 # local initialOpenedWindows 617 # local windowID 618 # set themeName to "Solarized Dark xterm-256color" 619 # 620 # (* Store the IDs of all the open terminal windows. *) 621 # set initialOpenedWindows to id of every window 622 # 623 # (* Open the custom theme so that it gets added to the list 624 # of available terminal themes (note: this will open two 625 # additional terminal windows). *) 626 # do shell script "open '$HOME/init/" & themeName & ".terminal'" 627 # 628 # (* Wait a little bit to ensure that the custom theme is added. *) 629 # delay 1 630 # 631 # (* Set the custom theme as the default terminal theme. *) 632 # set default settings to settings set themeName 633 # 634 # (* Get the IDs of all the currently opened terminal windows. *) 635 # set allOpenedWindows to id of every window 636 # 637 # repeat with windowID in allOpenedWindows 638 # 639 # (* Close the additional windows that were opened in order 640 # to add the custom theme to the list of terminal themes. *) 641 # if initialOpenedWindows does not contain windowID then 642 # close (every window whose id is windowID) 643 # 644 # (* Change the theme for the initial opened terminal windows 645 # to remove the need to close them in order for the custom 646 # theme to be applied. *) 647 # else 648 # set current settings of tabs of (every window whose id is windowID) to settings set themeName 649 # end if 650 # 651 # end repeat 652 # 653 #end tell 654 # 655 #EOD 656 657 # Enable “focus follows mouse” for Terminal.app and all X11 apps 658 # i.e. hover over a window and start typing in it without clicking first 659 #defaults write com.apple.terminal FocusFollowsMouse -bool true 660 #defaults write org.x.X11 wm_ffm -bool true 661 662 # Enable Secure Keyboard Entry in Terminal.app 663 # See: https://security.stackexchange.com/a/47786/8918 664 defaults write com.apple.terminal SecureKeyboardEntry -bool true 665 666 # Disable the annoying line marks 667 defaults write com.apple.Terminal ShowLineMarks -int 0 668 669 # Install the Solarized Dark theme for iTerm 670 #open "${HOME}/init/Solarized Dark.itermcolors" 671 672 # Don’t display the annoying prompt when quitting iTerm 673 defaults write com.googlecode.iterm2 PromptOnQuit -bool false 674 675 ############################################################################### 676 # Time Machine # 677 ############################################################################### 678 679 # Prevent Time Machine from prompting to use new hard drives as backup volume 680 defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 681 682 # Disable local Time Machine backups 683 #hash tmutil &> /dev/null && sudo tmutil disablelocal 684 685 ############################################################################### 686 # Activity Monitor # 687 ############################################################################### 688 689 # Show the main window when launching Activity Monitor 690 defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 691 692 # Visualize CPU usage in the Activity Monitor Dock icon 693 defaults write com.apple.ActivityMonitor IconType -int 5 694 695 # Show all processes in Activity Monitor 696 defaults write com.apple.ActivityMonitor ShowCategory -int 0 697 698 # Sort Activity Monitor results by CPU usage 699 defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 700 defaults write com.apple.ActivityMonitor SortDirection -int 0 701 702 ############################################################################### 703 # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 704 ############################################################################### 705 706 # Enable the debug menu in Address Book 707 defaults write com.apple.addressbook ABShowDebugMenu -bool true 708 709 # Enable Dashboard dev mode (allows keeping widgets on the desktop) 710 defaults write com.apple.dashboard devmode -bool true 711 712 # Enable the debug menu in iCal (pre-10.8) 713 defaults write com.apple.iCal IncludeDebugMenu -bool true 714 715 # Use plain text mode for new TextEdit documents 716 defaults write com.apple.TextEdit RichText -int 0 717 # Open and save files as UTF-8 in TextEdit 718 defaults write com.apple.TextEdit PlainTextEncoding -int 4 719 defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 720 721 # Enable the debug menu in Disk Utility 722 defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 723 defaults write com.apple.DiskUtility advanced-image-options -bool true 724 725 # Auto-play videos when opened with QuickTime Player 726 defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true 727 728 ############################################################################### 729 # Mac App Store # 730 ############################################################################### 731 732 # Enable the WebKit Developer Tools in the Mac App Store 733 defaults write com.apple.appstore WebKitDeveloperExtras -bool true 734 735 # Enable Debug Menu in the Mac App Store 736 defaults write com.apple.appstore ShowDebugMenu -bool true 737 738 # Enable the automatic update check 739 defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true 740 741 # Check for software updates daily, not just once per week 742 defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 743 744 # Download newly available updates in background 745 defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 746 747 # Install System data files & security updates 748 defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 749 750 # Automatically download apps purchased on other Macs 751 defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 752 753 # Turn on app auto-update 754 defaults write com.apple.commerce AutoUpdate -bool true 755 756 # Allow the App Store to reboot machine on macOS updates 757 defaults write com.apple.commerce AutoUpdateRestartRequired -bool true 758 759 ############################################################################### 760 # Photos # 761 ############################################################################### 762 763 # Prevent Photos from opening automatically when devices are plugged in 764 defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 765 766 ############################################################################### 767 # Messages # 768 ############################################################################### 769 770 # Disable automatic emoji substitution (i.e. use plain text smileys) 771 defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 772 773 # Disable smart quotes as it’s annoying for messages that contain code 774 defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 775 776 # Disable continuous spell checking 777 defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 778 779 ############################################################################### 780 # Google Chrome & Google Chrome Canary # 781 ############################################################################### 782 783 # Disable the all too sensitive backswipe on trackpads 784 defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 785 defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 786 787 # Disable the all too sensitive backswipe on Magic Mouse 788 defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 789 defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 790 791 # Use the system-native print preview dialog 792 defaults write com.google.Chrome DisablePrintPreview -bool true 793 defaults write com.google.Chrome.canary DisablePrintPreview -bool true 794 795 # Expand the print dialog by default 796 defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 797 defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 798 799 ############################################################################### 800 # GPGMail 2 # 801 ############################################################################### 802 803 # Disable signing emails by default 804 defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 805 806 ############################################################################### 807 # Opera & Opera Developer # 808 ############################################################################### 809 810 # Expand the print dialog by default 811 defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true 812 defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true 813 814 ############################################################################### 815 # SizeUp.app # 816 ############################################################################### 817 818 # Start SizeUp at login 819 defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true 820 821 # Don’t show the preferences window on next start 822 defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false 823 824 ############################################################################### 825 # Sublime Text # 826 ############################################################################### 827 828 # Install Sublime Text settings 829 cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 830 831 ############################################################################### 832 # Spectacle.app # 833 ############################################################################### 834 835 # Set up my preferred keyboard shortcuts 836 cp -r init/spectacle.json ~/Library/Application\ Support/Spectacle/Shortcuts.json 2> /dev/null 837 838 ############################################################################### 839 # Transmission.app # 840 ############################################################################### 841 842 # Use `~/Documents/Torrents` to store incomplete downloads 843 #defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 844 #defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 845 846 # Use `~/Downloads` to store completed downloads 847 defaults write org.m0k.transmission DownloadLocationConstant -bool true 848 849 # Don’t prompt for confirmation before downloading 850 defaults write org.m0k.transmission DownloadAsk -bool false 851 defaults write org.m0k.transmission MagnetOpenAsk -bool false 852 853 # Don’t prompt for confirmation before removing non-downloading active transfers 854 defaults write org.m0k.transmission CheckRemoveDownloading -bool true 855 856 # Trash original torrent files 857 defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 858 859 # Hide the donate message 860 defaults write org.m0k.transmission WarningDonate -bool false 861 # Hide the legal disclaimer 862 defaults write org.m0k.transmission WarningLegal -bool false 863 864 # IP block list. 865 # Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ 866 defaults write org.m0k.transmission BlocklistNew -bool true 867 defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" 868 defaults write org.m0k.transmission BlocklistAutoUpdate -bool true 869 870 # Randomize port on launch 871 defaults write org.m0k.transmission RandomPort -bool true 872 873 ############################################################################### 874 # Twitter.app # 875 ############################################################################### 876 877 # Disable smart quotes as it’s annoying for code tweets 878 defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 879 880 # Show the app window when clicking the menu bar icon 881 defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 882 883 # Enable the hidden ‘Develop’ menu 884 defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 885 886 # Open links in the background 887 defaults write com.twitter.twitter-mac openLinksInBackground -bool true 888 889 # Allow closing the ‘new tweet’ window by pressing `Esc` 890 defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 891 892 # Show full names rather than Twitter handles 893 defaults write com.twitter.twitter-mac ShowFullNames -bool true 894 895 # Hide the app in the background if it’s not the front-most window 896 defaults write com.twitter.twitter-mac HideInBackground -bool true 897 898 ############################################################################### 899 # Tweetbot.app # 900 ############################################################################### 901 902 # Bypass the annoyingly slow t.co URL shortener 903 defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true 904 defaults write com.tapbots.TweetbotMac showStatusItem -int 0 905 906 ############################################################################### 907 # Reeder.app # 908 ############################################################################### 909 defaults write com.reederapp.rkit2.mac AppIconUnreadCount -int 2 910 defaults write com.reederapp.rkit2.mac AppOrderUnreadItems -int 1 911 defaults write com.reederapp.rkit2.mac OpenLinksInBackground -int 1 912 defaults write com.reederapp.rkit2.mac PrivateBrowsing -int 1 913 defaults write com.reederapp.rkit2.mac WebKitPrivateBrowsingEnabled -int 1 914 defaults write com.reederapp.rkit2.mac ShareRKServiceAppNet -dict enabled -int 0 915 defaults write com.reederapp.rkit2.mac ShareRKServiceBuffer -dict enabled -int 0 916 defaults write com.reederapp.rkit2.mac ShareRKServiceDelicious -dict enabled -int 0 917 defaults write com.reederapp.rkit2.mac ShareRKServiceEvernote -dict enabled -int 0 918 defaults write com.reederapp.rkit2.mac ShareRKServiceFacebook -dict enabled -int 0 919 defaults write com.reederapp.rkit2.mac ShareRKServiceInstapaper -dict enabled -int 0 "show-in-toolbar" -int 0 920 defaults write com.reederapp.rkit2.mac ShareRKServiceMailLink -dict enabled -int 1 "show-in-toolbar" -int 1 to -string "me@brad.is" 921 defaults write com.reederapp.rkit2.mac ShareRKServiceMarsEdit -dict enabled -int 0 922 # defaults write com.reederapp.rkit2.mac ShareRKServiceMessage -dict enabled -int 1 923 defaults write com.reederapp.rkit2.mac ShareRKServicePinboard -dict enabled -int 1 "show-in-toolbar" -int 1 924 defaults write com.reederapp.rkit2.mac ShareRKServiceQuoteFMRead -dict enabled -int 0 925 defaults write com.reederapp.rkit2.mac ShareRKServiceReadItLater -dict enabled -int 1 "show-in-toolbar" -int 1 926 defaults write com.reederapp.rkit2.mac ShareRKServiceReadability -dict enabled -int 0 927 # defaults write com.reederapp.rkit2.mac ShareRKServiceReadingList -dict enabled -int 1 928 # defaults write com.reederapp.rkit2.mac ShareRKServiceSafari -dict enabled -int 1 929 defaults write com.reederapp.rkit2.mac ShareRKServiceTwitter -dict enabled -int 0 930 931 ############################################################################### 932 # Kill affected applications # 933 ############################################################################### 934 935 for app in "Activity Monitor" \ 936 "Address Book" \ 937 "Calendar" \ 938 "cfprefsd" \ 939 "Contacts" \ 940 "Dock" \ 941 "Finder" \ 942 "Google Chrome Canary" \ 943 "Google Chrome" \ 944 "Mail" \ 945 "Messages" \ 946 "Opera" \ 947 "Photos" \ 948 "Reeder" \ 949 "Safari" \ 950 "SizeUp" \ 951 "Spectacle" \ 952 "SystemUIServer" \ 953 "Terminal" \ 954 "Transmission" \ 955 "Tweetbot" \ 956 "Twitter" \ 957 "iCal"; do 958 killall "${app}" &> /dev/null 959 done 960 echo "Done. Note that some of these changes require a logout/restart to take effect."