I have customized text editing bindings in ~/Library/KeyBindings/DefaultKeyBinding.dict but they all stopped working in TextEdit.app 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?

  • 2
    The custom keybindings work normally for me in TextEdit. Have you tried replacing your DefaultKeyBinding.dict with something like {"a"=(insertText:,"test");}?
    – Lri
    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

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.

  • 1
    Thank fcuk for your answer. I was completely reinstalling my user account because I thought Pages/Keynote had some hidden user setting that kept them locked onto an older version of my DefaultKeyBinding.dict. Like you I had version controlled it after that change. I still need to version control my user account settings, which are spread across directories and files throughout my ~/home. It had seemed like symlinks to files in a usersettings project were the answer. Instead I will version control my entire home, .gitignore all files by default, and whitelist the files I want.
    – Riaz Rizvi
    Mar 9 '18 at 17:30

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .