Applying com.apple.symbolichotkeys
changes instantaneously
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:
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:
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.