Applying com.apple.symbolichotkeys changes instantaneously

Created On:

macOS ships with a defaults utility that allows scripting of various system and application preferences. Common tweaks include adjusting key repeat rates, controlling scroll direction and more. It can be easier to run a command that hunt through various preference panes and allows you to version control your preferences.

I’ve found that there is an interesting quirk when adjusting com.apple.symbolichotkeys however. Other sets of preferences typically apply immediately or right after you restart Finder. However changes to com.apple.symbolichotkeys don’t appear to apply instantaneously. For example, running:

defaults write com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 64 "
  <dict>
    <key>enabled</key><false/>
    <key>value</key><dict>
      <key>type</key><string>standard</string>
      <key>parameters</key>
      <array>
        <integer>32</integer>
        <integer>49</integer>
        <integer>1048576</integer>
      </array>
    </dict>
  </dict>
"

Disables the default ⌘-<space> binding that ships with macOS, which by default opens up Spotlight1. It’s equivalent of opening up System Preferences > Keyboard > Shortcuts > Spotlight and adjusting the keyboard settings there.

However running the defaults command does not appear to take effect right away. If another application tries to bind to ⌘-<space> it will get an error. Further, the System Preferences UI is not changed until you restart your computer.

To get around this oddity, we can use a private utility called activateSettings that ships with macOS. After adjusting com.apple.symbolichotkeys.plist with the defaults command simply run:

/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u

Disassembly of this binary shows that it will read all of the values in com.apple.symbolichotkeys and bind all of those shortcuts, forcing them to take effect immediately. This allows anyone to adjust those shortcuts via defaults without restarting.


  1. More magic numbers and their functionality can be found here↩︎