Global defaults in macOS Mojave

There are settings for a great many features in Mojave, and the common problem is discovering where any given setting is, and how to control it. Some are exposed in the GUI, others are hidden away from easy access. This article concentrates on global settings which are usually presented in a pane in System Preferences, or the NSGlobalDomain of defaults.

Each user’s default and other settings are stored in three main locations:

  • those for individual apps are kept in their preference files, XML property lists which you should find in ~/Library/Preferences, or /Library/Preferences for those which apply to all users;
  • those for controls within components of macOS are most commonly kept in individual preference files, many of which I have listed in this article;
  • global settings may not appear in user-accessible preferences, and their only access may be through the defaults command, or utilities such as MacPilot, TinkerTool, etc.

Changing those settings is not simple, as I have explained here. The most robust and universal ways are to use the app’s own controls or those provided in panes in System Preferences and elsewhere, as appropriate, or to use the defaults command in Terminal.

Knowing which settings you can change is usually not a problem for those which are stored in accessible property lists and other files, as you can view those files readily, even if editing them directly would not be a wise move. They are not, of course, comprehensive: if an app is still using an internally-set default, that may not have been written to the file, but there is no more general way of discovering exactly what can be set.

Global settings are the biggest problem. Apple doesn’t document them, and using the defaults command you can only see those which have been formally set. Here is a partial list of those known in recent versions of macOS, which may work in Mojave and later:

  • Apps, disable App Nap for all apps NSAppSleepDisabled -bool true
  • Apps, disable automatic termination of inactive apps NSDisableAutomaticTermination -bool true
  • Displays, enable subpixel font rendering on non-Apple LCDs AppleFontSmoothing -int 1 or 2
  • File save, expand save panel by default NSNavPanelExpandedStateForSaveMode -bool true and NSNavPanelExpandedStateForSaveMode2 -bool true
  • File save, save to disk by default rather than to iCloud NSDocumentSaveNewDocumentsToCloud -bool false
  • Finder, show all filename extensions AppleShowAllExtensions -bool true
  • Interface, action on double-clicking window AppleActionOnDoubleClick -string "Maximize"
  • Interface, appearance mode AppleInterfaceStyle -string "Dark"
  • Interface, always show scrollbars AppleShowScrollBars -string "WhenScrolling" or "Automatic" or "Always"
  • Interface, close always confirms changes NSCloseAlwaysConfirmsChanges -bool true
  • Interface, disable ‘natural’ scrolling com.apple.swipescrolldirection -bool false
  • Interface, disable menu bar transparency AppleEnableMenuBarTransparency -bool false
  • Interface, disable opening and closing window animations NSAutomaticWindowAnimationsEnabled -bool false
  • Interface, disable scroller navigation with mouse swipe AppleEnableMouseSwipeNavigateWithScrolls -bool false
  • Interface, disable smooth scrolling NSScrollAnimationEnabled -bool false
  • Interface, disable the over-the-top focus ring animation NSUseAnimatedFocusRing -bool false
  • Interface, enable full keyboard access for all controls AppleKeyboardUIMode -int 3 normal 2
  • Interface, enable spring-loading for directories com.apple.springing.enabled -bool true
  • Interface, increase window resize speed for Cocoa applicationsNSWindowResizeTime -float 0.001. Useful for sheets as well as windows, in making them open more quickly. This doesn’t apply to manual resizing or the zoom button. (Thanks to Michael Tsai.)
  • Interface, miniaturise on double-click AppleMiniaturizeOnDoubleClick -bool true
  • Interface, quit always saves windows NSQuitAlwaysKeepsWindows -bool true
  • Interface, remove the spring loading delay for directories com.apple.springing.delay -float 0 standard 0.5
  • Interface, set highlight colour to green AppleHighlightColor -string "0.764700 0.976500 0.568600"
  • Interface, set sidebar icon size to medium NSTableViewDefaultSizeMode -int 2
  • Interface, table view default size NSTableViewDefaultSizeMode -int 2
  • Keyboard, disable press-and-hold for keys in favor of key repeat ApplePressAndHoldEnabled -bool false
  • Keyboard, enable full keyboard access for all controls AppleKeyboardUIMode -int 3
  • Keyboard, set a shorter delay until key repeat InitialKeyRepeat -int 12 normal 68
  • Keyboard, set a very fast keyboard repeat rate KeyRepeat -int 1 normal 6
  • Localisation, set locale AppleLocale -string "en_GB@currency=EUR", or "en_GB", or "en_US" etc.
  • Localisation, set measurement units AppleMeasurementUnits -string "Centimeters" or "Inches"
  • Localisation, set metric units AppleMetricUnits -bool true
  • Localisation, set temperature units AppleTemperatureUnit -string "Celsius"
  • Print, expand print panel by default PMPrintingExpandedStateForPrint -bool true and PMPrintingExpandedStateForPrint2 -bool true
  • Sound, disable flash with system beep com.apple.sound.beep.flash -bool false
  • Sound, set system beep sound com.apple.sound.beep.sound -string "/System/Library/Sounds/Sosumi.aiff"
  • Text, disable auto-correct NSAutomaticSpellingCorrectionEnabled -bool false
  • Text, disable automatic capitalisation NSAutomaticCapitalizationEnabled -bool false
  • Text, disable automatic period substitution NSAutomaticPeriodSubstitutionEnabled -bool false
  • Text, disable automatic text completion NSAutomaticTextCompletionEnabled -bool false
  • Text, disable smart dashes NSAutomaticDashSubstitutionEnabled -bool false
  • Text, disable smart quotes NSAutomaticQuoteSubstitutionEnabled -bool false
  • Text, disable web automatic spelling correction WebAutomaticSpellingCorrectionEnabled -bool false
  • Text, display ASCII control characters using caret notation in standard text views NSTextShowsControlCharacters -bool true
  • Text, spell checker automatically identifies languages NSSpellCheckerAutomaticallyIdentifiesLanguages -bool true
  • Trackpad, enable Force Click com.apple.trackpad.forceClick -bool true
  • Trackpad, scaling factor com.apple.trackpad.scaling -float 1.5
  • Web views, add a contextual menu item for showing the Web Inspector WebKitDeveloperExtras -bool true

To change any of these in Terminal, type a command of the form
defaults write -g settingname type value
where settingname is the name of the setting given above, like WebKitDeveloperExtras, type is the type option such as -bool, and value is the value to set it to, such as true.

When set, check the setting by reading it, using a command of the form
defaults read -g settingname
which should return the setting which you have just made.

So, to set the temperature units to Celsius, first type
defaults write -g AppleTemperatureUnit -string "Celsius"
then check the setting with
defaults read -g AppleTemperatureUnit

Returning any of these to their default setting is just a matter of writing the default value. Apple changes these without warning, sometimes in minor updates to macOS: they can come and go, and may stop working for no apparent reason.

Some settings take immediate effect. Most require the affected apps etc. to be restarted, for example the Finder to be reloaded. A few may require you to log out and back in, or restart, before they work. Others may only apply until you next start your Mac up, when you will need to set them again.

The global defaults also contain some potentially useful information, such as defining whether a FaceTime camera, external USB SuperDrive, or Magic Trackpad are supported:
"Apple Inc. FaceTime HD Camera (Built-in)" -bool true
"Apple Inc. MacBook Air SuperDrive" -bool true
"Apple Inc. Magic Trackpad 2" -bool true

They contain the list of recent locations to use in file save and open dialogs, listed under NSNavRecentPlaces. To save your current global defaults to a text file, use the following in Terminal:
defaults read NSGlobalDomain > DefaultsGlobal.txt
and you can then open DefaultsGlobal.txt in a text editor.

Many of these defaults are listed at Mathias Bynens’ GitHub, from which I have borrowed freely, and I would also like to acknowledge the help of Michael Tsai in compiling them.