Is there a native way to rebind keys in OS X without requiring a 3rd party tool?

I'm interested in rebinding my whole keyboard layout, not specific shortcut keys. It's not a standard layout either, so I can't just change it from Qwerty to Azerty, for example. I need to be able to choose exactly which keys are at each location.

I noticed that Mac OS X has the directories KeyBindings and Keyboard Layouts under the ~/Library/ folder. Are these related to what I want to do? If so, how would I use them?

  • You're not giving a whole lot of useful information. WHAT type of keyboard, i.e., brand, layout, and what language? – Greg Dec 30 '10 at 16:40
  • Also, the KeyBindings and Keyboard Layouts are where .dict files get stored, which is what I talked about in my answer. Google has some good hits for mac os KeyBindings. Also, the TextMate site has Key bindings for switchers – Greg Dec 30 '10 at 16:45
  • 3
    @Senseful Why impose the restriction "without requiring a 3rd party tool?" Ukelele was created for the purpose you describe, and is free. It is a utility that creates the Mac OS X keyboard layout files you need. There is no native keyboard layout file editor included with the system. – ghoppe Dec 30 '10 at 17:19
  • @ghoppe: After reading Ukelele's description, it would fit my requirements since it simplifies the creation of .keylayout files, which are a native feature of the OS. – Senseful Dec 30 '10 at 19:09
  • @Greg: I'm looking for a solution which isn't dependent on a specific keyboard as I would want a solution that works everywhere. The language is English. The keyboard's layout is Qwerty, but I want to rebind it to a custom layout that I can design. The links you provided are useful, so thanks. Do you know if there is any difference between a .dict and a .keylayout file that is mentioned on the Ukelele website? – Senseful Dec 30 '10 at 19:14

You mean besides the "System Preferences > Keyboard > Keyboard Shortcuts" settings? (Click on the ? button in the bottom-right for more info.)

The Mac has dictionary (.dict) files for configuring parts of apps, system services. There are .dict files for the keyboard layout that can be edited by the property editor app, which is part of Apple's XCode development environment. Be very careful to understand that messing with them without knowing what you are doing can, and most likely will, break stuff.

/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/StandardKeyBinding.dict is an example. If you have TextMate, /Applications/TextMate.app/Contents/Resources/KeyBindings.dict is another. TextMate's site has a little write-up about how it uses the key bindings.

Also, look to the right at the "Related" section. There are some similar questions that might give you more ideas, such as "Best key remapper tool?".

That should be enough to get you started.

Apple's Technical Note TN2056 "Installable Keyboard Layouts" is something you should probably read, then search for more info from that point. You're messing with stuff that can make your machine hard to work with if it isn't done right, so arm yourself with enough information to know what you are doing. Apple's Technical documentation is the top-level for their developer documentation. Their support forum would be another good resource.

  • Sorry, I should have specified that this is for rebinding a keyboard layout rather than shortcut keys. Thanks for the info though. – Senseful Dec 30 '10 at 14:31
  • If you mean that you want to change between one international type of keyboard to another, then check under "System Preferences > Language & Text > Input Sources". – Greg Dec 30 '10 at 16:39

I noticed that Mac OS X has the directories KeyBindings and Keyboard Layouts under the ~/Library/ folder. Are these related to what I want to do? If so, how would I use them?

This article might answer your last two questions: http://xahlee.info/kbd/osx_keybinding.html

You must log in to answer this question.

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