Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Customizing the OS X keyboard map System
There have been a couple of help requests for remapping the OS X keyboard. There's very little info out there right now about this topic, but I just stumbled across a bit of evidence that it should be possible, although more difficult than it has been in the past.

Reading the MacAddict forums, I came across a thread called OS X Key Mappings. In that thread, there's an email posted from Marcel Bresnick, the author of "PrefEdit," who also has written some OS X Server 1.x keyboard mapping hacks. Here's a snippet of his response on customizing the OS X keyboard maps:
The keyboard layouts are stored in:


The * has to be replaced by the respective language name. Every language package contains 32 keyboard maps for _all_ keyboards, so there are in fact 224 (!) keyboard definitions. (This doesn't make sense, looks like a quick hack to implement Macintosh keyboards on top of Darwin...) If you want to do it right, you would have to repeat the keyboard redefinition for all language packages.
He goes on to explain how to edit the files (in theory, not step-by-step). Head on over to MacAddict and read the rest of the Marcel's email for an overview of how the process would work. Warning - this editing is not for the timid, and if you mess up, you'll have no keyboard -- so back everything up first, and make sure you know how to use single-user mode!
  • Currently 3.25 / 5
  You rated: 4 / 5 (4 votes cast)

Customizing the OS X keyboard map | 6 comments | Create New Account
Click here to return to the 'Customizing the OS X keyboard map' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Customizing the keyboard
Authored by: Nycta on May 09, '01 03:30:49AM
As a French person working with an American keyboard, I needed a way to have an easy access to accentuated characters. ResEdit makes it very easy to customize one's own keyboard configuration, but MacOS X needs a little more work to be done. Here's a tip I found on : 1/ copy a valid font in the (home)/Library/Fonts folder 2/ with Resedit, create a file named myKCHR.rsrc with the customized KCHR and a copy of the adequate itlb (name the KCHR since this is the name that will eventually appear in the International Preference Panel). Put myKCHR.rsrc in your Home directory. 3/ open terminal and type su + password 4/ type /Developer/Tools/DeRez myKCHR.rsrc > /tmp/myKCHR.r 5/ type /Developer/Tools/Rez -useDF -a -o /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Resources/HIToolbox.rsrc /tmp/myKCHR.r 6/ log out, log in and select the new layout in the International Panel of the System Preferences

[ Reply to This | # ]
Customizing the keyboard (swap any key!)
Authored by: Morganizer on Nov 09, '01 06:41:28PM
I recently bought a cheap USB keyboard to replace my OEM dinky keyboard. It's nice having a forward delete key again, but the Command and Option keys are reversed ('cause the keyboard is made for Windows PCs). So I've worked out how to swap the keys in OS10.1. The hack affects the entire system, including Classic. You'll need to install the Developer Tools and sign up with ADC at So here goes... Download the IOUSBFamily source files: href=""> Save the archive in a folder of your choice. Launch Terminal, navigate to the folder you saved the .tar.gz file in and execute the following command: gnutar -xvfz IOUSBFamily-1.8.4GMc3.tar.gz This will create a folder called "IOUSBFamily-1.8.4GMc3.tar.gz". If you get a message about the SCM status operation failing, just click the Disable button (at least, that's what I did; feel free to correct me). Inside the folder is a project file and a bunch of folders filled with libraries. Source code!! Double click on the file called "IOUSBFamily.pbproj" and it will open in Project Builder. Click on the drop down arrow for "AppleUSBKeyboard" and then "Classes". Highlight the item called "cosmo_USB2ADB.cpp". On the right will appear the code for this resource. Scroll down past the header comments and you'll see a list of codes. Each one represents a key. Fortunately for us the ones we're looking for were commented by a considerate programmer. To switch the Command and Option keys, simply swap their position in the list. Thus: 0x3a, // e2 Left option/alt key 0x37, // e3 Left command key Becomes: 0x37, // e3 Left command key 0x3a, // e2 Left option/alt key Do the same for the right hand keys, and then select File -> Save. Now just select Build -> Build from the menu bar. When it's finished there will be a new directory in the "IOUSBFamily-1.8.4GMc3.tar.gz" folder called "build". Inside it are the compiled binaries that you just created from your modified source code. Go back to the Terminal, navigate to the build directory, and then enter the following commands, along with your root password when asked for it: sudo -s cp -R AppleUSBKeyboard.kext /System/Library/Extensions That's it! Just restart your computer and the keys are switched. If your system goes haywire boot to single user mode or perform sudo, then navigate to the /System/Library/Extensions folder and rm -R AppleUSBKeyboard.kext to get yourself back to normal. I'm considering posting the binary on my account, if someone can reassure me that doing so won't violate the Apple Public Source License. -Morgan System: G4/350 AGP OSX 10.1 Build: 5L14 Keyboard: Yahoo! USB Hub Internet Keyboard (Sakar Int'l Inc. model# 9001AH)

[ Reply to This | # ]
Customizing the keyboard (swap any key!)
Authored by: antosha on Nov 26, '02 08:31:11PM

Hey, I haven't successfully been able to swap command with option/alt, but to swap Caps Lock and Ctrl on USB mice, you no longer need to rebuild AppleUSBKeyboard.kext, and instead can do the following, taken from From , look below.

1. Edit /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBKeyboard.kext/Contents/Info.plist and add:

<key>Swap control and capslock</key>

under IOKitPersonalities/AppleUSBKeyboard. You can, of course, use the PropertyListEditor application that comes with the developer tools to add the property.

2. Remove the file /System/Library/Extensions.mkext. This is a device driver cache. The modified AppleUSBKeyboard driver will not be loaded if this exists. The next reboot will rebuild this file with the modified AppleUSBKeyboard driver. (And the reboot will take a bit longer than normal as it builds the file.)

3. Reboot.

Swiping Option/Command

I tried to use Swipe command option, but it doesn't work. I suspect that I don't have the right names for those keys. Any ideas?


anton aaattt

[ Reply to This | # ]
Another source...
Authored by: robg on May 11, '01 01:34:28AM
I received an email from "Ricky M." who has put together a set of instructions for keyboard modifications; you can read them here:

[ Reply to This | # ]
Remap the caps lock key
Authored by: semios on Jul 23, '01 08:42:17PM
For those of you looking to remap your caps lock key to the control key, I've developed just the hack for you. Take a look at the iControl website for binaries and sources that I put together.

[ Reply to This | # ]
Customizing the OS X keyboard map
Authored by: jaschasd on Jun 03, '11 01:02:19AM

The tool KeyRemap4MacBook,, lets you remap the keyboard in any way you could possibly desire, and several ways I can't imagine ever desiring. It's super useful. (my left shift key was stuck on, making my laptop unusable without an external keyboard, and it let me disable just the left shift key)

[ Reply to This | # ]