Mac OS X: Where customized keyboard shortcuts are stored (and how to restore them)

Posted by Pierre Igot in: Macintosh
August 3rd, 2005 • 3:34 pm

As experienced Mac OS X users know, Mac OS X (10.3 or 10.4) comes with a built-in feature that allows the user to customize keyboard shortcuts.

This feature, which resides in a tab titled “Keyboard Shortcuts” in the “Keyboard & Mouse” preference pane in System Preferences, allows the user to either change existing keyboard shortcuts or add new ones, either in the Mac OS X environment as a whole (system-wide keyboard shortcuts) or in specific applications (application-specific keyboard shortcuts).

Providing access to this particular feature through a preference pane in System Preferences has its advantages, but one of the drawbacks is that it is very poor when it comes to giving the user an idea of where these settings are actually stored.

This is important, because it’s a fact of computing life that, at least from time to time, you have to reinstall your entire system. If you start using the keyboard shortcuts feature, you don’t want to have to recreate all your shortcuts from scratch the next time you do a clean install of the system. For one thing, the “Keyboard Shortcuts” tab in System Preferences gives you no option to print out a list of all your shortcuts. So you’d have to write them all down manually, and then recreate them all manually one by one on your new system.

Fortunately, this is not necessary. But it still is unclear how you, as the end user, can make sure that all your customized keyboard shortcuts can be transferred from one system configuration to another.

The fact of the matter is that the keyboard shortcuts that you define through the “Keyboard Shortcuts” tab in System Preferences are actually stored in several different places.

First, there is the issue of system-wide shortcuts. While it is tempting to lump them all together in the same category, they are actually, internally speaking, linked to several different parts of the system. And, accordingly, they are stored in several different places.

For example, if you change a keyboard shortcut that has something to do with the Dock, even though it’s a system-wide shortcut, it is actually stored in the preference file for the Dock, i.e. in the file called “com.apple.dock.plist” inside your home preferences folder.

If you change a keyboard shortcut for Exposé, however, it will be stored in “com.apple.universalaccess.plist“. Many system-wide shortcuts are stored in that file, actually, even though its name seems to imply that it’s only for users who make use of the “Universal Access” features.

I’ve tried to experiment with various shortcuts and see which other plist files are modified, and I think that some of the system-wide shortcuts are also stored in “com.apple.systempreferences.plist“, although I cannot figure out which ones exactly right now.

And I haven’t experimented with all the settings, so it’s still possible that other system-wide settings are stored in yet another plist file.

At the very least, if you want to make sure that your customized system-wide shortcuts are backed up, you should back up these three files.

Then there is the issue of application-specific shortcuts. Not all applications support these shortcuts. For example, Adobe’s applications (including the latest CS2 versions) do not support this architecture at all. InDesign has its own feature for customizing keyboard shortcuts, which you have to use if you want to customize shortcuts in that application. And, if you want to make sure these settings are preserved, you have to back up InDesign’s own preference settings, which are stored in a variety of files.

Somewhat surprisingly, even though Microsoft Word 2004 also has its own feature for customizing keyboard shortcuts, it does appear to be compatible with Mac OS X’s built-in feature. For example, I was able to change the keyboard shortcut for the “Copy” command in Word’s “Edit” menu through System Preferences. (You have to quit and relaunch the application for the change to take effect.) But I am not entirely sure how it coexists with Word’s built-in feature. (I suspect that Word’s built-in feature stores keyboard shortcuts in one location whereas Mac OS X stores Word-specific keyboard shortcuts in another.)

For Mac OS X applications that fully support Mac OS X’s keyboard shortcuts feature, the answer to the question of where the application-specific keyboard shortcuts are stored is pretty easy: It is typically in the corresponding plist file. For example, if you change or add a keyboard shortcut for Mail, the keyboard shortcut will be stored in “com.apple.mail.plist“.

So if you want to preserve your customized keyboard shortcuts, you need to make sure you keep a backup copy of each application’s plist file (in addition to the ones mentioned above).

It should also be noted that the Finder is just another Mac OS X application and that Finder-specific keyboard shortcuts are stored in the “com.apple.finder.plist” file.

But that’s where the drawback of having a centralized location for customizing keyboard shortcuts becomes apparent. If you add a customized keyboard shortcut to Mail, for example, the change is stored in “com.apple.mail.plist“.

If you then do an “Erase and Install” installation of Mac OS X and want to restore the Mail-specific shortcuts, you need to make sure that you have a backup copy of “com.apple.mail.plist” that you can copy back into the “Preferences” folder after you’ve installed Mac OS X. (“com.apple.mail.plist” also contains other vital information about your e-mail accounts, so you’ll want to back up this file regularly anyway.)

But then if you do that and go to the “Keyboard Shortcuts” tab in System Preferences after that, you’ll notice that your Mail-specific keyboard shortcuts are not listed, even though they are very much there in the “com.apple.mail.plist” file that you copied back from your backup, and they definitely appear in the Mail interface when you launch it, and work just fine.

So why aren’t they listed in the “Keyboard Shortcuts” tab in System Preferences? Because you’ve erased your system and reinstalled from scratch, so Mac OS X’s keyboard shortcuts feature has lost all traces of the actual customization process. In other words, the customized Mail-specific keyboard shortcuts are still there, but the “Keyboard Shortcuts” tab in System Preferences no longer knows about them.

And that’s rather unfortunate, because it means that the UI for the keyboard shortcuts feature in Mac OS X is not reliable.

Of course, I am not sure what the solution here would be. The entire interface for the feature would probably need to be rethought — and I see little sign of Apple being interested in that. So for now we have to live with things are they are.

You might also argue that many of the problems described here can be avoided by using the option to preserve or transfer user settings during the process of installing or reinstalling Mac OS X, which copies most of these plist files for you. That might be true (although I haven’t tested it to see if the customized application-specific shortcuts remain listed in the the “Keyboard Shortcuts” tab in System Preferences after such a process).

But there are a number of situations where you do not want to preserve or transfer user settings, and want to start from scratch instead. For example, it might be because your system has become unstable or some files have become corrupted (and you don’t know which ones). In such a situation, you will not want to use the option to preserve or transfer user settings.

You still have the option to restore some of the plist files mentioned above individually and manually from a backup. Whether it is a good idea or not is something that you are going to have to decide for yourself. Since these plist files contain many other settings in addition to keyboard shortcuts, by restoring them from a backup you are restoring a whole slew of other settings in addition to keyboard shortcuts. There is no way to separate the two.

I still think that this approach is not as elegant and “modular” as it could be. There should be a way to back up and restore customized keyboard shortcuts without restoring anything else, and without having to manually copy plist files. But it doesn’t look like such an improvement is a high priority for Apple at the moment.


7 Responses to “Mac OS X: Where customized keyboard shortcuts are stored (and how to restore them)”

  1. ssp says:

    Sure, the whole system might be more elegant in theory (but probably not in practice seeing that it comes from the old-age Next stuff) but I really don’t see the problem here. If you move to another machine you’ll copy your home folder with all the preferences anyway and there won’t be any problem.

    If you really think that migrating your application specific keyboard equivalents separately is crucial, you can still play the defaults system to extract them and the re-introduce them on your new system.

  2. LoonyPandora says:

    I really think System Preferences should take a few ideas from the OS X Server administration applications. With these applications, you can save the settings of each pane into a nice plist file by dragging out a small icon to your desktop. Restoring these settings involves just dropping the same plist file back onto that pane.

    I think it’s a nice elegant solution to the problem of ‘where preferences are stored’ – the answer is wherever you want to store them!

  3. Pierre Igot says:

    ssp: The problem is that copying the home folder is a “brute force” approach that fails to meet real world needs and doesn’t give the user a sense that he’s in control. Maybe it comes from my work as a professional trouble-shooter, but I think I am not alone in thinking that a good old “Erase and Install” from scratch (without transferring existing settings) is an excellent trouble-shooting tool, if only because it often is faster than trying to identify the actual source of a particular problem in order to be able to eliminate it.

    In such a context, the portability of user-defined settings is essential. Fortunately, there are many things in OS X that are easily portable without having to copy the entire home folder. But keyboard shortcuts is one of the areas where there is still too much “mystery” about where the settings are actually stored.

    I agree with LoonyPandora that the Mac OS X Server approach would be much better. As long as restoring settings from a stored copy only takes a few steps, it’s probably the most user-friendly approach, because it gives the user a sense that he is on control.

  4. ssp says:

    Pierre, I strongly disagree with your POV then. I consider copying the whole home folder to be the _only_ reasonable thing to do. Losing or having to rearrange my preferences or other data simply isn’t acceptable. ‘Erase and install’ is the brute force method for when things have seriously gone wrong and you have no clue what to do. To OS X’s merit I haven’t seen such situations yet. And personally I’m still using (a copy of) the same home folder that I had in X.0.

    But as I said if you really consider separate moving of the keyboard equivalents to be important, just read them out of the defaults system.

  5. Pierre Igot says:

    I am afraid I am no Terminal virtuoso. I have no idea what the defaults system is. I just know that it’s the command used in Terminal to access/change user defaults. I am talking about providing a user-friendly solution here.

    You might argue that copying the whole home folder is the user-friendly solution — but, as I said, it lacks the flexibility of a more granular approach.

  6. ssp says:

    I suppose the defaults system is a bit more than just the ‘defaults’ command in the Terminal. But indeed that command is a very quick way to access it and well worth knowing if what you’re doing involves managing preferences on the Mac.

    I don’t think that user-customisable keyboard equivalents can be particularly ‘user-friendly’ anyway (a good UI won’t need them anyway…). Even the number of people who are aware that this feature exists seems to be small. And the number of people who then go on and actually use it is even smaller.

  7. Pierre Igot says:

    I don’t agree that a good user-friendly interface doesn’t need customizable keyboard shortcuts. If that’s your point of view, obviously you have little interest in seeing a properly-designed “Keyboard Shortcuts” feature in Mac OS X. My post here is written from of the point of view of someone who thinks that customizable shortcuts are a legitimate part of the Mac OS X interface :).

    If we accept that premise, then we might be able to agree that the current interface could be improved.

Leave a Reply

Comments are closed.