Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have customized text editing bindings in ~/Library/KeyBindings/DefaultKeyBinding.dict but they all stopped working in when I upgraded to Lion. They still work fine in other Cocoa apps like Safari.

The system default bindings like ^F for moveForward: work as usual.

Has anyone else who uses DefaultKeyBinding.dict noticed this? Is there a way to fix it or any other way of customizing the key bindings in TextEdit?

share|improve this question
The custom keybindings work normally for me in TextEdit. Have you tried replacing your DefaultKeyBinding.dict with something like {"a"=(insertText:,"test");}? – user495470 Jun 7 '12 at 0:46
@LauriRanta thanks; knowing that I was the only one with the problem got me to finally investigate it properly. – mckeed Jun 7 '12 at 14:40
up vote 7 down vote accepted

The problem was that I had moved the actual DefaultKeyBinding.dict file somewhere else for version-control purposes and symlinked to it.

Most apps were loading the file through the symlink, but TextEdit (and, it turns out, a couple other apps that I thought just didn't support key bindings) must do something different and didn't see it.

So, oops, lesson learned. Don't symlink your system configuration files.

share|improve this answer

I had the same problem myself with symlinking this file, but I didn't want to give in to this limitation, so I created a git pre-commit hook to update ~/Library/KeyBindings/DefaultKeyBinding.dict whenever my version was committed.

Here is the code (for Git):


if [[ $(git diff --cached --name-only | grep '.configurations/DefaultKeyBinding.dict' | wc -l) -eq 1 ]]; 

   BASE_DIR=$(git rev-parse --show-toplevel)

   NORMAL=$(tput sgr0)
   BRIGHT=$(tput bold)
   GREEN=$(tput setaf 2)

   printf "${BRIGHT}${GREEN}The file <%s> was modified, updating %s${NORMAL}\n" $FILE_PATH_IN_SCM $FILE_PATH_IN_LIBRARY


To use it all you need to do is replace FILE_PATH_IN_SCM=${BASE_DIR}/.configurations/DefaultKeyBinding.dict with the location of the file in your Git Repository.

If you never created a git hook before (this was my first) - you need to place this code in:


Don't forget to run chmod +x <your-git-repo>/.git/hooks/pre-commit to make it executable.

Afterwards every commit involving this file will show something like:

The file </Users/myuser/.scripts/.configurations/DefaultKeyBinding.dict> was modified, updating /Users/myuser/Library/KeyBindings/DefaultKeyBinding.dict
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.