How to set system keyboard shortcuts via command line?

Solution 1:

Figured it out. You have to add the application you want to modify keys for to com.apple.universalaccess.

defaults write com.apple.universalaccess com.apple.custommenu.apps -array-add "com.googlecode.iterm2"

or if all keyboard equivalents are set via one file, you can also write the full list at once

defaults write com.apple.universalaccess com.apple.custommenu.apps -array "com.googlecode.iterm2" "com.apple.Safari" "com.google.Chrome"

The other thing that was tricky was, that my iterm2 prefs file is symlinked and therefore doesn't appear in the list of domains nor is read with the defaults tool. The keyboard however works, since it's listed in the prefs file already.