├── .macos ├── README.md └── REFERENCE.md /.macos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ~/.macos — https://mths.be/macos 4 | 5 | # Close any open System Preferences panes, to prevent them from overriding 6 | # settings we’re about to change 7 | osascript -e 'tell application "System Preferences" to quit' 8 | 9 | # Ask for the administrator password upfront 10 | sudo -v 11 | 12 | # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 13 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 14 | 15 | ############################################################################### 16 | # General UI/UX # 17 | ############################################################################### 18 | 19 | # Set computer name (as done via System Preferences → Sharing) 20 | #sudo scutil --set ComputerName "0x6D746873" 21 | #sudo scutil --set HostName "0x6D746873" 22 | #sudo scutil --set LocalHostName "0x6D746873" 23 | #sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873" 24 | 25 | # Disable the sound effects on boot 26 | sudo nvram SystemAudioVolume=" " 27 | 28 | # Disable transparency in the menu bar and elsewhere on Yosemite 29 | defaults write com.apple.universalaccess reduceTransparency -bool true 30 | 31 | # Set highlight color to green 32 | defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 33 | 34 | # Set sidebar icon size to medium 35 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 36 | 37 | # Always show scrollbars 38 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 39 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 40 | 41 | # Disable the over-the-top focus ring animation 42 | defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false 43 | 44 | # Disable smooth scrolling 45 | # (Uncomment if you’re on an older Mac that messes up the animation) 46 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 47 | 48 | # Increase window resize speed for Cocoa applications 49 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 50 | 51 | # Expand save panel by default 52 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 53 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 54 | 55 | # Expand print panel by default 56 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 57 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 58 | 59 | # Save to disk (not to iCloud) by default 60 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 61 | 62 | # Automatically quit printer app once the print jobs complete 63 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 64 | 65 | # Disable the “Are you sure you want to open this application?” dialog 66 | defaults write com.apple.LaunchServices LSQuarantine -bool false 67 | 68 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 69 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 70 | 71 | # Display ASCII control characters using caret notation in standard text views 72 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 73 | defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 74 | 75 | # Disable Resume system-wide 76 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 77 | 78 | # Disable automatic termination of inactive apps 79 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 80 | 81 | # Disable the crash reporter 82 | #defaults write com.apple.CrashReporter DialogType -string "none" 83 | 84 | # Set Help Viewer windows to non-floating mode 85 | defaults write com.apple.helpviewer DevMode -bool true 86 | 87 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 88 | # Commented out, as this is known to cause problems in various Adobe apps :( 89 | # See https://github.com/mathiasbynens/dotfiles/issues/237 90 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 91 | 92 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 93 | # in the login window 94 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 95 | 96 | # Disable Notification Center and remove the menu bar icon 97 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 98 | 99 | # Disable automatic capitalization as it’s annoying when typing code 100 | defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 101 | 102 | # Disable smart dashes as they’re annoying when typing code 103 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 104 | 105 | # Disable automatic period substitution as it’s annoying when typing code 106 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 107 | 108 | # Disable smart quotes as they’re annoying when typing code 109 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 110 | 111 | # Disable auto-correct 112 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 113 | 114 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 115 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 116 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 117 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 118 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 119 | 120 | ############################################################################### 121 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 122 | ############################################################################### 123 | 124 | # Trackpad: enable tap to click for this user and for the login screen 125 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 126 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 127 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 128 | 129 | # Trackpad: map bottom right corner to right-click 130 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 131 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 132 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 133 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 134 | 135 | # Disable “natural” (Lion-style) scrolling 136 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 137 | 138 | # Increase sound quality for Bluetooth headphones/headsets 139 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 140 | 141 | # Enable full keyboard access for all controls 142 | # (e.g. enable Tab in modal dialogs) 143 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 144 | 145 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 146 | defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 147 | defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 148 | # Follow the keyboard focus while zoomed in 149 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 150 | 151 | # Disable press-and-hold for keys in favor of key repeat 152 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 153 | 154 | # Set a blazingly fast keyboard repeat rate 155 | defaults write NSGlobalDomain KeyRepeat -int 1 156 | defaults write NSGlobalDomain InitialKeyRepeat -int 10 157 | 158 | # Set language and text formats 159 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 160 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 161 | defaults write NSGlobalDomain AppleLanguages -array "en" "nl" 162 | defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR" 163 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 164 | defaults write NSGlobalDomain AppleMetricUnits -bool true 165 | 166 | # Show language menu in the top right corner of the boot screen 167 | sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true 168 | 169 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 170 | sudo systemsetup -settimezone "Europe/Brussels" > /dev/null 171 | 172 | # Stop iTunes from responding to the keyboard media keys 173 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 174 | 175 | ############################################################################### 176 | # Energy saving # 177 | ############################################################################### 178 | 179 | # Enable lid wakeup 180 | sudo pmset -a lidwake 1 181 | 182 | # Restart automatically on power loss 183 | sudo pmset -a autorestart 1 184 | 185 | # Restart automatically if the computer freezes 186 | sudo systemsetup -setrestartfreeze on 187 | 188 | # Sleep the display after 15 minutes 189 | sudo pmset -a displaysleep 15 190 | 191 | # Disable machine sleep while charging 192 | sudo pmset -c sleep 0 193 | 194 | # Set machine sleep to 5 minutes on battery 195 | sudo pmset -b sleep 5 196 | 197 | # Set standby delay to 24 hours (default is 1 hour) 198 | sudo pmset -a standbydelay 86400 199 | 200 | # Never go into computer sleep mode 201 | sudo systemsetup -setcomputersleep Off > /dev/null 202 | 203 | # Hibernation mode 204 | # 0: Disable hibernation (speeds up entering sleep mode) 205 | # 3: Copy RAM to disk so the system state can still be restored in case of a 206 | # power failure. 207 | sudo pmset -a hibernatemode 0 208 | 209 | # Remove the sleep image file to save disk space 210 | sudo rm /private/var/vm/sleepimage 211 | # Create a zero-byte file instead… 212 | sudo touch /private/var/vm/sleepimage 213 | # …and make sure it can’t be rewritten 214 | sudo chflags uchg /private/var/vm/sleepimage 215 | 216 | ############################################################################### 217 | # Screen # 218 | ############################################################################### 219 | 220 | # Require password immediately after sleep or screen saver begins 221 | defaults write com.apple.screensaver askForPassword -int 1 222 | defaults write com.apple.screensaver askForPasswordDelay -int 0 223 | 224 | # Save screenshots to the desktop 225 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 226 | 227 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 228 | defaults write com.apple.screencapture type -string "png" 229 | 230 | # Disable shadow in screenshots 231 | defaults write com.apple.screencapture disable-shadow -bool true 232 | 233 | # Enable subpixel font rendering on non-Apple LCDs 234 | # Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 235 | defaults write NSGlobalDomain AppleFontSmoothing -int 1 236 | 237 | # Enable HiDPI display modes (requires restart) 238 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 239 | 240 | ############################################################################### 241 | # Finder # 242 | ############################################################################### 243 | 244 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 245 | defaults write com.apple.finder QuitMenuItem -bool true 246 | 247 | # Finder: disable window animations and Get Info animations 248 | defaults write com.apple.finder DisableAllAnimations -bool true 249 | 250 | # Set Desktop as the default location for new Finder windows 251 | # For other paths, use `PfLo` and `file:///full/path/here/` 252 | defaults write com.apple.finder NewWindowTarget -string "PfDe" 253 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 254 | 255 | # Show icons for hard drives, servers, and removable media on the desktop 256 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 257 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 258 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 259 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 260 | 261 | # Finder: show hidden files by default 262 | #defaults write com.apple.finder AppleShowAllFiles -bool true 263 | 264 | # Finder: show all filename extensions 265 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 266 | 267 | # Finder: show status bar 268 | defaults write com.apple.finder ShowStatusBar -bool true 269 | 270 | # Finder: show path bar 271 | defaults write com.apple.finder ShowPathbar -bool true 272 | 273 | # Display full POSIX path as Finder window title 274 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 275 | 276 | # Keep folders on top when sorting by name 277 | defaults write com.apple.finder _FXSortFoldersFirst -bool true 278 | 279 | # When performing a search, search the current folder by default 280 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 281 | 282 | # Disable the warning when changing a file extension 283 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 284 | 285 | # Enable spring loading for directories 286 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 287 | 288 | # Remove the spring loading delay for directories 289 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 290 | 291 | # Avoid creating .DS_Store files on network or USB volumes 292 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 293 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 294 | 295 | # Disable disk image verification 296 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 297 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 298 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 299 | 300 | # Automatically open a new Finder window when a volume is mounted 301 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 302 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 303 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 304 | 305 | # Show item info near icons on the desktop and in other icon views 306 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 307 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 308 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 309 | 310 | # Show item info to the right of the icons on the desktop 311 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 312 | 313 | # Enable snap-to-grid for icons on the desktop and in other icon views 314 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 315 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 316 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 317 | 318 | # Increase grid spacing for icons on the desktop and in other icon views 319 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 320 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 321 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 322 | 323 | # Increase the size of icons on the desktop and in other icon views 324 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 325 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 326 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 327 | 328 | # Use list view in all Finder windows by default 329 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv` 330 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 331 | 332 | # Disable the warning before emptying the Trash 333 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 334 | 335 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 336 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 337 | 338 | # Show the ~/Library folder 339 | chflags nohidden ~/Library 340 | 341 | # Show the /Volumes folder 342 | sudo chflags nohidden /Volumes 343 | 344 | # Remove Dropbox’s green checkmark icons in Finder 345 | file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 346 | [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 347 | 348 | # Expand the following File Info panes: 349 | # “General”, “Open with”, and “Sharing & Permissions” 350 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 351 | General -bool true \ 352 | OpenWith -bool true \ 353 | Privileges -bool true 354 | 355 | ############################################################################### 356 | # Dock, Dashboard, and hot corners # 357 | ############################################################################### 358 | 359 | # Enable highlight hover effect for the grid view of a stack (Dock) 360 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 361 | 362 | # Set the icon size of Dock items to 36 pixels 363 | defaults write com.apple.dock tilesize -int 36 364 | 365 | # Change minimize/maximize window effect 366 | defaults write com.apple.dock mineffect -string "scale" 367 | 368 | # Minimize windows into their application’s icon 369 | defaults write com.apple.dock minimize-to-application -bool true 370 | 371 | # Enable spring loading for all Dock items 372 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 373 | 374 | # Show indicator lights for open applications in the Dock 375 | defaults write com.apple.dock show-process-indicators -bool true 376 | 377 | # Wipe all (default) app icons from the Dock 378 | # This is only really useful when setting up a new Mac, or if you don’t use 379 | # the Dock to launch apps. 380 | #defaults write com.apple.dock persistent-apps -array 381 | 382 | # Show only open applications in the Dock 383 | #defaults write com.apple.dock static-only -bool true 384 | 385 | # Don’t animate opening applications from the Dock 386 | defaults write com.apple.dock launchanim -bool false 387 | 388 | # Speed up Mission Control animations 389 | defaults write com.apple.dock expose-animation-duration -float 0.1 390 | 391 | # Don’t group windows by application in Mission Control 392 | # (i.e. use the old Exposé behavior instead) 393 | defaults write com.apple.dock expose-group-by-app -bool false 394 | 395 | # Disable Dashboard 396 | defaults write com.apple.dashboard mcx-disabled -bool true 397 | 398 | # Don’t show Dashboard as a Space 399 | defaults write com.apple.dock dashboard-in-overlay -bool true 400 | 401 | # Don’t automatically rearrange Spaces based on most recent use 402 | defaults write com.apple.dock mru-spaces -bool false 403 | 404 | # Remove the auto-hiding Dock delay 405 | defaults write com.apple.dock autohide-delay -float 0 406 | # Remove the animation when hiding/showing the Dock 407 | defaults write com.apple.dock autohide-time-modifier -float 0 408 | 409 | # Automatically hide and show the Dock 410 | defaults write com.apple.dock autohide -bool true 411 | 412 | # Make Dock icons of hidden applications translucent 413 | defaults write com.apple.dock showhidden -bool true 414 | 415 | # Don’t show recent applications in Dock 416 | defaults write com.apple.dock show-recents -bool false 417 | 418 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 419 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 420 | 421 | # Reset Launchpad, but keep the desktop wallpaper intact 422 | find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 423 | 424 | # Add iOS & Watch Simulator to Launchpad 425 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 426 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" 427 | 428 | # Add a spacer to the left side of the Dock (where the applications are) 429 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 430 | # Add a spacer to the right side of the Dock (where the Trash is) 431 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 432 | 433 | # Hot corners 434 | # Possible values: 435 | # 0: no-op 436 | # 2: Mission Control 437 | # 3: Show application windows 438 | # 4: Desktop 439 | # 5: Start screen saver 440 | # 6: Disable screen saver 441 | # 7: Dashboard 442 | # 10: Put display to sleep 443 | # 11: Launchpad 444 | # 12: Notification Center 445 | # 13: Lock Screen 446 | # Top left screen corner → Mission Control 447 | defaults write com.apple.dock wvous-tl-corner -int 2 448 | defaults write com.apple.dock wvous-tl-modifier -int 0 449 | # Top right screen corner → Desktop 450 | defaults write com.apple.dock wvous-tr-corner -int 4 451 | defaults write com.apple.dock wvous-tr-modifier -int 0 452 | # Bottom left screen corner → Start screen saver 453 | defaults write com.apple.dock wvous-bl-corner -int 5 454 | defaults write com.apple.dock wvous-bl-modifier -int 0 455 | 456 | ############################################################################### 457 | # Safari & WebKit # 458 | ############################################################################### 459 | 460 | # Privacy: don’t send search queries to Apple 461 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 462 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 463 | 464 | # Press Tab to highlight each item on a web page 465 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 466 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 467 | 468 | # Show the full URL in the address bar (note: this still hides the scheme) 469 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 470 | 471 | # Set Safari’s home page to `about:blank` for faster loading 472 | defaults write com.apple.Safari HomePage -string "about:blank" 473 | 474 | # Prevent Safari from opening ‘safe’ files automatically after downloading 475 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 476 | 477 | # Allow hitting the Backspace key to go to the previous page in history 478 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 479 | 480 | # Hide Safari’s bookmarks bar by default 481 | defaults write com.apple.Safari ShowFavoritesBar -bool false 482 | 483 | # Hide Safari’s sidebar in Top Sites 484 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 485 | 486 | # Disable Safari’s thumbnail cache for History and Top Sites 487 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 488 | 489 | # Enable Safari’s debug menu 490 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 491 | 492 | # Make Safari’s search banners default to Contains instead of Starts With 493 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 494 | 495 | # Remove useless icons from Safari’s bookmarks bar 496 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 497 | 498 | # Enable the Develop menu and the Web Inspector in Safari 499 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 500 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 501 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 502 | 503 | # Add a context menu item for showing the Web Inspector in web views 504 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 505 | 506 | # Enable continuous spellchecking 507 | defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true 508 | # Disable auto-correct 509 | defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false 510 | 511 | # Disable AutoFill 512 | defaults write com.apple.Safari AutoFillFromAddressBook -bool false 513 | defaults write com.apple.Safari AutoFillPasswords -bool false 514 | defaults write com.apple.Safari AutoFillCreditCardData -bool false 515 | defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false 516 | 517 | # Warn about fraudulent websites 518 | defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true 519 | 520 | # Disable plug-ins 521 | defaults write com.apple.Safari WebKitPluginsEnabled -bool false 522 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false 523 | 524 | # Disable Java 525 | defaults write com.apple.Safari WebKitJavaEnabled -bool false 526 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false 527 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false 528 | 529 | # Block pop-up windows 530 | defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false 531 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false 532 | 533 | # Disable auto-playing video 534 | #defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false 535 | #defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false 536 | #defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 537 | #defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 538 | 539 | # Enable “Do Not Track” 540 | defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true 541 | 542 | # Update extensions automatically 543 | defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true 544 | 545 | ############################################################################### 546 | # Mail # 547 | ############################################################################### 548 | 549 | # Disable send and reply animations in Mail.app 550 | defaults write com.apple.mail DisableReplyAnimations -bool true 551 | defaults write com.apple.mail DisableSendAnimations -bool true 552 | 553 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 554 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 555 | 556 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 557 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9" 558 | 559 | # Display emails in threaded mode, sorted by date (oldest at the top) 560 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 561 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 562 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 563 | 564 | # Disable inline attachments (just show the icons) 565 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 566 | 567 | # Disable automatic spell checking 568 | defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 569 | 570 | ############################################################################### 571 | # Spotlight # 572 | ############################################################################### 573 | 574 | # Hide Spotlight tray-icon (and subsequent helper) 575 | #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 576 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 577 | # been indexed before. 578 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 579 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 580 | # Change indexing order and disable some search results 581 | # Yosemite-specific search results (remove them if you are using macOS 10.9 or older): 582 | # MENU_DEFINITION 583 | # MENU_CONVERSION 584 | # MENU_EXPRESSION 585 | # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 586 | # MENU_WEBSEARCH (send search queries to Apple) 587 | # MENU_OTHER 588 | defaults write com.apple.spotlight orderedItems -array \ 589 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 590 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 591 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 592 | '{"enabled" = 1;"name" = "PDF";}' \ 593 | '{"enabled" = 1;"name" = "FONTS";}' \ 594 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 595 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 596 | '{"enabled" = 0;"name" = "CONTACT";}' \ 597 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 598 | '{"enabled" = 0;"name" = "IMAGES";}' \ 599 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 600 | '{"enabled" = 0;"name" = "MUSIC";}' \ 601 | '{"enabled" = 0;"name" = "MOVIES";}' \ 602 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 603 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 604 | '{"enabled" = 0;"name" = "SOURCE";}' \ 605 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 606 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 607 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 608 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 609 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 610 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 611 | # Load new settings before rebuilding the index 612 | killall mds > /dev/null 2>&1 613 | # Make sure indexing is enabled for the main volume 614 | sudo mdutil -i on / > /dev/null 615 | # Rebuild the index from scratch 616 | sudo mdutil -E / > /dev/null 617 | 618 | ############################################################################### 619 | # Terminal & iTerm 2 # 620 | ############################################################################### 621 | 622 | # Only use UTF-8 in Terminal.app 623 | defaults write com.apple.terminal StringEncodings -array 4 624 | 625 | # Use a modified version of the Solarized Dark theme by default in Terminal.app 626 | osascript < /dev/null && sudo tmutil disablelocal 699 | 700 | ############################################################################### 701 | # Activity Monitor # 702 | ############################################################################### 703 | 704 | # Show the main window when launching Activity Monitor 705 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 706 | 707 | # Visualize CPU usage in the Activity Monitor Dock icon 708 | defaults write com.apple.ActivityMonitor IconType -int 5 709 | 710 | # Show all processes in Activity Monitor 711 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 712 | 713 | # Sort Activity Monitor results by CPU usage 714 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 715 | defaults write com.apple.ActivityMonitor SortDirection -int 0 716 | 717 | ############################################################################### 718 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 719 | ############################################################################### 720 | 721 | # Enable the debug menu in Address Book 722 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 723 | 724 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 725 | defaults write com.apple.dashboard devmode -bool true 726 | 727 | # Enable the debug menu in iCal (pre-10.8) 728 | defaults write com.apple.iCal IncludeDebugMenu -bool true 729 | 730 | # Use plain text mode for new TextEdit documents 731 | defaults write com.apple.TextEdit RichText -int 0 732 | # Open and save files as UTF-8 in TextEdit 733 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 734 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 735 | 736 | # Enable the debug menu in Disk Utility 737 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 738 | defaults write com.apple.DiskUtility advanced-image-options -bool true 739 | 740 | # Auto-play videos when opened with QuickTime Player 741 | defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true 742 | 743 | ############################################################################### 744 | # Mac App Store # 745 | ############################################################################### 746 | 747 | # Enable the WebKit Developer Tools in the Mac App Store 748 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 749 | 750 | # Enable Debug Menu in the Mac App Store 751 | defaults write com.apple.appstore ShowDebugMenu -bool true 752 | 753 | # Enable the automatic update check 754 | defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true 755 | 756 | # Check for software updates daily, not just once per week 757 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 758 | 759 | # Download newly available updates in background 760 | defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 761 | 762 | # Install System data files & security updates 763 | defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 764 | 765 | # Automatically download apps purchased on other Macs 766 | defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 767 | 768 | # Turn on app auto-update 769 | defaults write com.apple.commerce AutoUpdate -bool true 770 | 771 | # Allow the App Store to reboot machine on macOS updates 772 | defaults write com.apple.commerce AutoUpdateRestartRequired -bool true 773 | 774 | ############################################################################### 775 | # Photos # 776 | ############################################################################### 777 | 778 | # Prevent Photos from opening automatically when devices are plugged in 779 | defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 780 | 781 | ############################################################################### 782 | # Messages # 783 | ############################################################################### 784 | 785 | # Disable automatic emoji substitution (i.e. use plain text smileys) 786 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 787 | 788 | # Disable smart quotes as it’s annoying for messages that contain code 789 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 790 | 791 | # Disable continuous spell checking 792 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 793 | 794 | ############################################################################### 795 | # Google Chrome & Google Chrome Canary # 796 | ############################################################################### 797 | 798 | # Disable the all too sensitive backswipe on trackpads 799 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 800 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 801 | 802 | # Disable the all too sensitive backswipe on Magic Mouse 803 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 804 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 805 | 806 | # Use the system-native print preview dialog 807 | defaults write com.google.Chrome DisablePrintPreview -bool true 808 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 809 | 810 | # Expand the print dialog by default 811 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 812 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 813 | 814 | ############################################################################### 815 | # GPGMail 2 # 816 | ############################################################################### 817 | 818 | # Disable signing emails by default 819 | defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 820 | 821 | ############################################################################### 822 | # Opera & Opera Developer # 823 | ############################################################################### 824 | 825 | # Expand the print dialog by default 826 | defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true 827 | defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true 828 | 829 | ############################################################################### 830 | # SizeUp.app # 831 | ############################################################################### 832 | 833 | # Start SizeUp at login 834 | defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true 835 | 836 | # Don’t show the preferences window on next start 837 | defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false 838 | 839 | ############################################################################### 840 | # Sublime Text # 841 | ############################################################################### 842 | 843 | # Install Sublime Text settings 844 | cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 845 | 846 | ############################################################################### 847 | # Spectacle.app # 848 | ############################################################################### 849 | 850 | # Set up my preferred keyboard shortcuts 851 | cp -r init/spectacle.json ~/Library/Application\ Support/Spectacle/Shortcuts.json 2> /dev/null 852 | 853 | ############################################################################### 854 | # Transmission.app # 855 | ############################################################################### 856 | 857 | # Use `~/Documents/Torrents` to store incomplete downloads 858 | defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 859 | defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 860 | 861 | # Use `~/Downloads` to store completed downloads 862 | defaults write org.m0k.transmission DownloadLocationConstant -bool true 863 | 864 | # Don’t prompt for confirmation before downloading 865 | defaults write org.m0k.transmission DownloadAsk -bool false 866 | defaults write org.m0k.transmission MagnetOpenAsk -bool false 867 | 868 | # Don’t prompt for confirmation before removing non-downloading active transfers 869 | defaults write org.m0k.transmission CheckRemoveDownloading -bool true 870 | 871 | # Trash original torrent files 872 | defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 873 | 874 | # Hide the donate message 875 | defaults write org.m0k.transmission WarningDonate -bool false 876 | # Hide the legal disclaimer 877 | defaults write org.m0k.transmission WarningLegal -bool false 878 | 879 | # IP block list. 880 | # Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ 881 | defaults write org.m0k.transmission BlocklistNew -bool true 882 | defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" 883 | defaults write org.m0k.transmission BlocklistAutoUpdate -bool true 884 | 885 | # Randomize port on launch 886 | defaults write org.m0k.transmission RandomPort -bool true 887 | 888 | ############################################################################### 889 | # Twitter.app # 890 | ############################################################################### 891 | 892 | # Disable smart quotes as it’s annoying for code tweets 893 | defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 894 | 895 | # Show the app window when clicking the menu bar icon 896 | defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 897 | 898 | # Enable the hidden ‘Develop’ menu 899 | defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 900 | 901 | # Open links in the background 902 | defaults write com.twitter.twitter-mac openLinksInBackground -bool true 903 | 904 | # Allow closing the ‘new tweet’ window by pressing `Esc` 905 | defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 906 | 907 | # Show full names rather than Twitter handles 908 | defaults write com.twitter.twitter-mac ShowFullNames -bool true 909 | 910 | # Hide the app in the background if it’s not the front-most window 911 | defaults write com.twitter.twitter-mac HideInBackground -bool true 912 | 913 | ############################################################################### 914 | # Tweetbot.app # 915 | ############################################################################### 916 | 917 | # Bypass the annoyingly slow t.co URL shortener 918 | defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true 919 | 920 | ############################################################################### 921 | # Kill affected applications # 922 | ############################################################################### 923 | 924 | for app in "Activity Monitor" \ 925 | "Address Book" \ 926 | "Calendar" \ 927 | "cfprefsd" \ 928 | "Contacts" \ 929 | "Dock" \ 930 | "Finder" \ 931 | "Google Chrome Canary" \ 932 | "Google Chrome" \ 933 | "Mail" \ 934 | "Messages" \ 935 | "Opera" \ 936 | "Photos" \ 937 | "Safari" \ 938 | "SizeUp" \ 939 | "Spectacle" \ 940 | "SystemUIServer" \ 941 | "Terminal" \ 942 | "Transmission" \ 943 | "Tweetbot" \ 944 | "Twitter" \ 945 | "iCal"; do 946 | killall "${app}" &> /dev/null 947 | done 948 | echo "Done. Note that some of these changes require a logout/restart to take effect." 949 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # macOS Defaults 2 | 3 | A place to centralize the great work [@mathiasbynens](http://mths.be/macos) did gathering and fostering a community around finding and documenting macOS default configuration from the command-line. 4 | 5 | ## Repo configuration 6 | Note: There are 2 branches. 7 | 8 | 1. `master`: Reflects http://mths.be/macos at all times. 9 | 2. `suttle`: My personal preferences and settings. 10 | 11 | 12 | ## Executing the .macos file 13 | 14 | When setting up a new Mac, you may want to set some sensible macOS defaults: 15 | 16 | `./.macos` 17 | 18 | ## Reference 19 | Unsure of what you can modify or which commands to use? 20 | Check out [REFERENCE.md](REFERENCE.md). 21 | -------------------------------------------------------------------------------- /REFERENCE.md: -------------------------------------------------------------------------------- 1 | # macOS Default Values Command Reference 2 | 3 | ## chflags 4 | change file flags 5 | 6 | ``` 7 | usage: chflags [-fhv] [-R [-H | -L | -P]] flags file ... 8 | ``` 9 | 10 | [chflags man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/chflags.1.html) 11 | 12 | 13 | ## defaults 14 | Command line interface to a user's defaults. 15 | 16 | ``` 17 | ❯ defaults 18 | 19 | Syntax: 20 | 21 | 'defaults' [-currentHost | -host ] followed by one of the following: 22 | 23 | read shows all defaults 24 | read shows defaults for given domain 25 | read shows defaults for given domain, key 26 | 27 | read-type shows the type for the given domain, key 28 | 29 | write writes domain (overwrites existing) 30 | write writes key for domain 31 | 32 | rename renames old_key to new_key 33 | 34 | delete deletes domain 35 | delete deletes key in domain 36 | 37 | import writes all of the keys in path to domain 38 | export saves domain as a binary plist to path 39 | domains lists all domains 40 | find lists all entries containing word 41 | help print this help 42 | 43 | is ( | -app | -globalDomain ) 44 | or a path to a file omitting the '.plist' extension 45 | 46 | is one of: 47 | 48 | -string 49 | -data 50 | -int[eger] 51 | -float 52 | -bool[ean] (true | false | yes | no) 53 | -date 54 | -array ... 55 | -array-add ... 56 | -dict ... 57 | -dict-add ... 58 | ``` 59 | 60 | **Tip:** Use `defaults domains` to to list all domains available. 61 | 62 | [defaults man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/defaults.1.html) 63 | 64 | 65 | ## launchctl: 66 | Unload daemons/agents and generally control launchd 67 | 68 | ``` 69 | ❯ launchctl help 70 | 71 | usage: launchctl 72 | load Load configuration files and/or directories 73 | unload Unload configuration files and/or directories 74 | start Start specified job 75 | stop Stop specified job 76 | submit Submit a job from the command line 77 | remove Remove specified job 78 | bootstrap Bootstrap launchd 79 | list List jobs and information about jobs 80 | setenv Set an environmental variable in launchd 81 | unsetenv Unset an environmental variable in launchd 82 | getenv Get an environmental variable from launchd 83 | export Export shell settings from launchd 84 | debug Set the WaitForDebugger flag for the target job to true. 85 | limit View and adjust launchd resource limits 86 | stdout Redirect launchd's standard out to the given path 87 | stderr Redirect launchd's standard error to the given path 88 | shutdown Prepare for system shutdown 89 | singleuser Switch to single-user mode 90 | getrusage Get resource usage statistics from launchd 91 | log Adjust the logging level or mask of launchd 92 | umask Change launchd's umask 93 | bsexec Execute a process within a different Mach bootstrap subset 94 | bslist List Mach bootstrap services and optional servers 95 | bstree Show the entire Mach bootstrap tree. Requires root privileges. 96 | managerpid Print the PID of the launchd managing this Mach bootstrap. 97 | manageruid Print the UID of the launchd managing this Mach bootstrap. 98 | managername Print the name of this Mach bootstrap. 99 | asuser Execute a subcommand in the given user's context. 100 | exit Exit the interactive invocation of launchctl 101 | quit Quit the interactive invocation of launchctl 102 | help This help output 103 | ``` 104 | 105 | **Tip:** Use `launchctl list` to show the currently set values for `launchctl`. 106 | 107 | [launchctl man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/launchctl.1.html) 108 | 109 | 110 | ## mdutil 111 | Manage the metadata stores used by Spotlight 112 | 113 | ``` 114 | Usage: mdutil -pEsa -i (on|off) -d volume ... 115 | mdutil -t {volume-path | deviceid} fileid 116 | Utility to manage Spotlight indexes. 117 | -p Publish metadata. 118 | -i (on|off) Turn indexing on or off. 119 | -d Disable Spotlight activity for volume (re-enable using -i on). 120 | -E Erase and rebuild index. 121 | -s Print indexing status. 122 | -t Resolve files from file id with an optional volume path or device id. 123 | -a Apply command to all volumes. 124 | -V vol Apply command to all stores on the specified volume. 125 | -v Display verbose information. 126 | NOTE: Run as owner for network homes, otherwise run as root. 127 | ``` 128 | 129 | [mdutil man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/mdutil.1.html) 130 | 131 | ## nvram 132 | Manipulate firmware NVRAM variables 133 | 134 | ``` 135 | nvram [-x] [-p] [-f filename] [-d name] [-c] name[=value] ... 136 | -x use XML format for printing or reading variables 137 | (must appear before -p or -f) 138 | -p print all firmware variables 139 | -f set firmware variables from a text file 140 | -d delete the named variable 141 | -c delete all variables 142 | name=value set named variable 143 | name print variable 144 | Note that arguments and options are executed in order. 145 | ``` 146 | 147 | **Tip:** Use `nvram -xp` to show all firmware variables in XML format. 148 | 149 | [nvram man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/nvram.8.html) 150 | 151 | 152 | ## PListBuddy 153 | Read and write values to plists 154 | 155 | ``` 156 | ❯ /usr/libexec/PlistBuddy 157 | 158 | Usage: PlistBuddy [-cxh] 159 | -c "" execute command, otherwise run in interactive mode 160 | -x output will be in the form of an xml plist where appropriate 161 | -h print the complete help info, with command guide 162 | ``` 163 | 164 | ### PListBuddy help 165 | ``` 166 | ❯ /usr/libexec/PlistBuddy -h 167 | 168 | Command Format: 169 | Help - Prints this information 170 | Exit - Exits the program, changes are not saved to the file 171 | Save - Saves the current changes to the file 172 | Revert - Reloads the last saved version of the file 173 | Clear [] - Clears out all existing entries, and creates root of Type 174 | Print [] - Prints value of Entry. Otherwise, prints file 175 | Set - Sets the value at Entry to Value 176 | Add [] - Adds Entry to the plist, with value Value 177 | Copy - Copies the EntrySrc property to EntryDst 178 | Delete - Deletes Entry from the plist 179 | Merge [] - Adds the contents of file.plist to Entry 180 | Import - Creates or sets Entry the contents of file 181 | 182 | Entry Format: 183 | Entries consist of property key names delimited by colons. Array items 184 | are specified by a zero-based integer index. Examples: 185 | :CFBundleShortVersionString 186 | :CFBundleDocumentTypes:2:CFBundleTypeExtensions 187 | 188 | Types: 189 | string 190 | array 191 | dict 192 | bool 193 | real 194 | integer 195 | date 196 | data 197 | 198 | Examples: 199 | Set :CFBundleIdentifier com.apple.plistbuddy 200 | Sets the CFBundleIdentifier property to com.apple.plistbuddy 201 | Add :CFBundleGetInfoString string "App version 1.0.1" 202 | Adds the CFBundleGetInfoString property to the plist 203 | Add :CFBundleDocumentTypes: dict 204 | Adds a new item of type dict to the CFBundleDocumentTypes array 205 | Add :CFBundleDocumentTypes:0 dict 206 | Adds the new item to the beginning of the array 207 | Delete :CFBundleDocumentTypes:0 dict 208 | Deletes the FIRST item in the array 209 | Delete :CFBundleDocumentTypes 210 | Deletes the ENTIRE CFBundleDocumentTypes array 211 | ``` 212 | 213 | [PlistBuddy man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/PlistBuddy.8.html) 214 | 215 | 216 | ## pmset 217 | Manipulate power management settings 218 | 219 | **Tips:** 220 | * Use `pmset -g` to show the currently settings. 221 | * Use `pmset -g ps` to show power source info. 222 | 223 | ``` 224 | ❯ pmset -g 225 | Active Profiles: 226 | Battery Power -1* 227 | AC Power -1 228 | Currently in use: 229 | standbydelay 86400 230 | standby 1 231 | halfdim 1 232 | hibernatefile /var/vm/sleepimage 233 | darkwakes 0 234 | gpuswitch 2 235 | disksleep 10 236 | sleep 10 237 | autopoweroffdelay 14400 238 | hibernatemode 3 239 | autopoweroff 1 240 | ttyskeepawake 1 241 | displaysleep 2 242 | acwake 0 243 | lidwake 1 244 | ``` 245 | 246 | ``` 247 | ❯ pmset -g ps 248 | Now drawing from 'Battery Power' 249 | -InternalBattery-0 98%; discharging; 4:52 remaining 250 | ``` 251 | [pmset man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/pmset.1.html) 252 | 253 | 254 | ## scutil 255 | Manage system configuration parameters 256 | 257 | ``` 258 | Usage: scutil 259 | interactive access to the dynamic store. 260 | 261 | or: scutil --prefs [preference-file] 262 | interactive access to the [raw] stored preferences. 263 | 264 | or: scutil [-W] -r nodename 265 | or: scutil [-W] -r address 266 | or: scutil [-W] -r local-address remote-address 267 | check reachability of node, address, or address pair (-W to "watch"). 268 | 269 | or: scutil -w dynamic-store-key [ -t timeout ] 270 | -w wait for presense of dynamic store key 271 | -t time to wait for key 272 | 273 | or: scutil --get pref 274 | or: scutil --set pref [newval] 275 | or: scutil --get filename path key 276 | pref display (or set) the specified preference. Valid preferences 277 | include: 278 | ComputerName, LocalHostName, HostName 279 | newval New preference value to be set. If not specified, 280 | the new value will be read from standard input. 281 | 282 | or: scutil --dns 283 | show DNS configuration. 284 | 285 | or: scutil --proxy 286 | show "proxy" configuration. 287 | 288 | or: scutil --nwi 289 | show network information 290 | 291 | or: scutil --nc 292 | show VPN network configuration information. Use --nc help for full command list 293 | ``` 294 | [scutil man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/scutil.8.html) 295 | 296 | 297 | ## systemsetup 298 | Configuration tool for certain machine settings in System Preferences. 299 | 300 | ``` 301 | ❯ systemsetup -help 302 | 303 | systemsetup Help Information 304 | ------------------------------------- 305 | Usage: systemsetup -getdate 306 | Display current date. 307 | 308 | Usage: systemsetup -setdate 309 | Set current date to . 310 | 311 | Usage: systemsetup -gettime 312 | Display current time. 313 | 314 | Usage: systemsetup -settime 315 | Set current time to . 316 | 317 | Usage: systemsetup -gettimezone 318 | Display current time zone. 319 | 320 | Usage: systemsetup -settimezone 321 | Set current time zone to . Use "-listtimezones" to list time zones. 322 | 323 | Usage: systemsetup -listtimezones 324 | List time zones supported by this machine. 325 | 326 | Usage: systemsetup -getusingnetworktime 327 | Display whether network time is on or off. 328 | 329 | Usage: systemsetup -setusingnetworktime 330 | Set using network time to either or . 331 | 332 | Usage: systemsetup -getnetworktimeserver 333 | Display network time server. 334 | 335 | Usage: systemsetup -setnetworktimeserver 336 | Set network time server to . 337 | 338 | Usage: systemsetup -getsleep 339 | Display amount of idle time until computer, display and hard disk sleep. 340 | 341 | Usage: systemsetup -setsleep 342 | Set amount of idle time until computer, display and hard disk sleep to . 343 | Specify "Never" or "Off" for never. 344 | 345 | Usage: systemsetup -getcomputersleep 346 | Display amount of idle time until computer sleeps. 347 | 348 | Usage: systemsetup -setcomputersleep 349 | Set amount of idle time until compputer sleeps to . 350 | Specify "Never" or "Off" for never. 351 | 352 | Usage: systemsetup -getdisplaysleep 353 | Display amount of idle time until display sleeps. 354 | 355 | Usage: systemsetup -setdisplaysleep 356 | Set amount of idle time until display sleeps to . 357 | Specify "Never" or "Off" for never. 358 | 359 | Usage: systemsetup -getharddisksleep 360 | Display amount of idle time until hard disk sleeps. 361 | 362 | Usage: systemsetup -setharddisksleep 363 | Set amount of idle time until hard disk sleeps to . 364 | Specify "Never" or "Off" for never. 365 | 366 | Usage: systemsetup -getwakeonmodem 367 | Display whether wake on modem is on or off. 368 | 369 | Usage: systemsetup -setwakeonmodem 370 | Set wake on modem to either or . 371 | 372 | Usage: systemsetup -getwakeonnetworkaccess 373 | Display whether wake on network access is on or off. 374 | 375 | Usage: systemsetup -setwakeonnetworkaccess 376 | Set wake on network access to either or . 377 | 378 | Usage: systemsetup -getrestartpowerfailure 379 | Display whether restart on power failure is on or off. 380 | 381 | Usage: systemsetup -setrestartpowerfailure 382 | Set restart on power failure to either or . 383 | 384 | Usage: systemsetup -getrestartfreeze 385 | Display whether restart on freeze is on or off. 386 | 387 | Usage: systemsetup -setrestartfreeze 388 | Set restart on freeze to either or . 389 | 390 | Usage: systemsetup -getallowpowerbuttontosleepcomputer 391 | Display whether the power button is able to sleep the computer. 392 | 393 | Usage: systemsetup -setallowpowerbuttontosleepcomputer 394 | Enable or disable whether the power button can sleep the computer. 395 | 396 | Usage: systemsetup -getremotelogin 397 | Display whether remote login is on or off. 398 | 399 | Usage: systemsetup -setremotelogin 400 | Set remote login to either or . Use "systemsetup -f -setremotelogin off" to suppress prompting when turning remote login off. 401 | 402 | Usage: systemsetup -getremoteappleevents 403 | Display whether remote apple events are on or off. 404 | 405 | Usage: systemsetup -setremoteappleevents 406 | Set remote apple events to either or . 407 | 408 | Usage: systemsetup -getcomputername 409 | Display computer name. 410 | 411 | Usage: systemsetup -setcomputername 412 | Set computer name to . 413 | 414 | Usage: systemsetup -getlocalsubnetname 415 | Display local subnet name. 416 | 417 | Usage: systemsetup -setlocalsubnetname 418 | Set local subnet name to . 419 | 420 | Usage: systemsetup -getstartupdisk 421 | Display current startup disk. 422 | 423 | Usage: systemsetup -setstartupdisk 424 | Set current startup disk to . 425 | 426 | Usage: systemsetup -liststartupdisks 427 | List startup disks on this machine. 428 | 429 | Usage: systemsetup -getwaitforstartupafterpowerfailure 430 | Get the number of seconds after which the computer will start up after a power failure. 431 | 432 | Usage: systemsetup -setwaitforstartupafterpowerfailure 433 | Set the number of seconds after which the computer will start up after a power failure. The value must be a multiple of 30 seconds. 434 | 435 | Usage: systemsetup -getdisablekeyboardwhenenclosurelockisengaged 436 | Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged. 437 | 438 | Usage: systemsetup -setdisablekeyboardwhenenclosurelockisengaged 439 | Set whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged. 440 | 441 | Usage: systemsetup -version 442 | Display version of systemsetup tool. 443 | 444 | Usage: systemsetup -help 445 | Display help. 446 | 447 | Usage: systemsetup -printCommands 448 | Display commands. 449 | ``` 450 | 451 | 452 | **Tip:** Use `systemsetup -printCommands` to show the available commands. 453 | 454 | ``` 455 | ❯ systemsetup -printCommands 456 | systemsetup -getdate 457 | systemsetup -setdate 458 | systemsetup -gettime 459 | systemsetup -settime 460 | systemsetup -gettimezone 461 | systemsetup -settimezone 462 | systemsetup -listtimezones 463 | systemsetup -getusingnetworktime 464 | systemsetup -setusingnetworktime 465 | systemsetup -getnetworktimeserver 466 | systemsetup -setnetworktimeserver 467 | systemsetup -getsleep 468 | systemsetup -setsleep 469 | systemsetup -getcomputersleep 470 | systemsetup -setcomputersleep 471 | systemsetup -getdisplaysleep 472 | systemsetup -setdisplaysleep 473 | systemsetup -getharddisksleep 474 | systemsetup -setharddisksleep 475 | systemsetup -getwakeonmodem 476 | systemsetup -setwakeonmodem 477 | systemsetup -getwakeonnetworkaccess 478 | systemsetup -setwakeonnetworkaccess 479 | systemsetup -getrestartpowerfailure 480 | systemsetup -setrestartpowerfailure 481 | systemsetup -getrestartfreeze 482 | systemsetup -setrestartfreeze 483 | systemsetup -getallowpowerbuttontosleepcomputer 484 | systemsetup -setallowpowerbuttontosleepcomputer 485 | systemsetup -getremotelogin 486 | systemsetup -setremotelogin 487 | systemsetup -getremoteappleevents 488 | systemsetup -setremoteappleevents 489 | systemsetup -getcomputername 490 | systemsetup -setcomputername 491 | systemsetup -getlocalsubnetname 492 | systemsetup -setlocalsubnetname 493 | systemsetup -getstartupdisk 494 | systemsetup -setstartupdisk 495 | systemsetup -liststartupdisks 496 | systemsetup -getwaitforstartupafterpowerfailure 497 | systemsetup -setwaitforstartupafterpowerfailure 498 | systemsetup -getdisablekeyboardwhenenclosurelockisengaged 499 | systemsetup -setdisablekeyboardwhenenclosurelockisengaged 500 | systemsetup -version 501 | systemsetup -help 502 | systemsetup -printCommands 503 | ``` 504 | [systemsetup man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/systemsetup.8.html) 505 | 506 | 507 | ## tmutil 508 | Time Machine utility 509 | 510 | ``` 511 | ❯ tmutil 512 | Usage: tmutil help 513 | 514 | Usage: tmutil version 515 | 516 | Usage: tmutil enable 517 | 518 | Usage: tmutil disable 519 | 520 | Usage: tmutil startbackup [-a | --auto] [-b | --block] [-r | --rotation] [-d | --destination dest_id] 521 | 522 | Usage: tmutil stopbackup 523 | 524 | Usage: tmutil enablelocal 525 | 526 | Usage: tmutil disablelocal 527 | 528 | Usage: tmutil snapshot 529 | 530 | Usage: tmutil delete snapshot_path ... 531 | 532 | Usage: tmutil restore [-v] src dst 533 | 534 | Usage: tmutil compare [-a@esmugtndEX] [-D depth] [-I name] 535 | tmutil compare [-a@esmugtndEX] [-D depth] [-I name] snapshot_path 536 | tmutil compare [-a@esmugtndEUX] [-D depth] [-I name] path1 path2 537 | 538 | Usage: tmutil setdestination [-a] mount_point 539 | tmutil setdestination [-ap] afp://user[:pass]@host/share 540 | 541 | Usage: tmutil removedestination destination_id 542 | 543 | Usage: tmutil destinationinfo [-X] 544 | 545 | Usage: tmutil addexclusion [-p] item ... 546 | 547 | Usage: tmutil removeexclusion [-p] item ... 548 | 549 | Usage: tmutil isexcluded item ... 550 | 551 | Usage: tmutil inheritbackup machine_directory 552 | tmutil inheritbackup sparse_bundle 553 | 554 | Usage: tmutil associatedisk [-a] mount_point volume_backup_directory 555 | 556 | Usage: tmutil latestbackup 557 | 558 | Usage: tmutil listbackups 559 | 560 | Usage: tmutil machinedirectory 561 | 562 | Usage: tmutil calculatedrift machine_directory 563 | 564 | Usage: tmutil uniquesize path ... 565 | 566 | Use `tmutil help ` for more information about a specific verb. 567 | ``` 568 | 569 | [tmutil man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/tmutil.8.html) 570 | --------------------------------------------------------------------------------