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

Swap control and caps lock on USB keyboards System
For all you old-school people out there, you can swap the left control and caps-lock keys very easily in Mac OS X (if you have a USB keyboard).

In the file System -> Library -> Extensions -> IOUSBFamily.kext -> Contents -> PlugIns -> AppleUSBKeyboard.kext -> Contents -> Info.plist, look for the IOKitPersonalities key, and the AppleUSBKeyboard key within that. Once there, add these lines:
Swap control and capslock
When you have done this, remove /System/Library/Extensions.mkext and restart. Removing the Extensions.mkext file forces OS X to rebuild the device driver cache with the modified file at the next restart (which may take longer than normal as the file is rebuilt).

This will not work on ADB keyboards (which means this won't work on Powerbooks since those are actually ADB keyboards).

This tip is originally posted by John Fieber on his site. You can find a copy of the properly edited plist file there if you need a complete example of what the finished product looks like. I felt it needed to posted at a higher traffic site so that perhaps more people can be shown the light. I'll leave it up to the reader to figure out why this is useful.

[Editor's note: I can't vouch for this one, as it would take me forever to relearn decades of habits! However, when I looked at my version of the Info.plist file, I found that I did not have the AppleUSBKeyboard key within the IOKitPersonalities key, despite typing this from a USB keyboard!]

Panther proven!

NOTE: This hint will work with Panther, but with some changes. The correct file to edit is /System -> Library -> Extensions -> IOUSBFamily.kext -> Contents -> PlugIns -> IOUSBHIDDriver.kext -> Contents -> Info.plist. Within that Info.plist file, the property to edit is IOKitPersonalities/Generic Keyboard, and you must touch /System/Library/Extensions to get it to work now.

This is all documented here:
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

Swap control and caps lock on USB keyboards | 16 comments | Create New Account
Click here to return to the 'Swap control and caps lock on USB keyboards' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Swap FN & CTRL keys on iBook?
Authored by: petey on Feb 22, '02 11:46:24AM

i'm dying to swap the fn key on my iBook with the ctrl key, to make accessing contextual menus easier.

is there some way to modify this hack to do that?


(in OS 9, there was a hack that worked to make the fn key into a ctrl key, and had the added benefit of having the fn key at the same time still retain its functions in toggeling the hardwired Eject, Volume, and Brightness function keys. Best of all possible worlds. Now if Apple would just produce a 2 button trackpad, none of this would be an issue...)

[ Reply to This | # ]
laptop keyboards aren't USB
Authored by: semios on Feb 22, '02 03:12:25PM
This is a great tip and glad to see it reach a wider audience, but it won't work with laptop keyboard because they're not actually USB. Which is the reason I wrote uControl to map the control key to caps lock (not vice versa) and it incidentally remaps enter key just right of the space bar to a command/open apple key (good for TiBooks).

[ Reply to This | # ]
What's the point?
Authored by: aranor on Feb 22, '02 04:07:48PM

Maybe it's just because I don't use a USB keyboard (I'm on a first-gen iBook, so it's ADB, right?), but I just don't see the point of this hack. Why would you want to swap the control and caps lock keys? Can someone shed light on this puzzling question?

[ Reply to This | # ]
What's the point?
Authored by: macqueen on Feb 22, '02 04:45:29PM

In a word, "emacs".

This is a very widely used editor under Unix, and when using emacs probably around a third of all keystrokes are control keys. Most emacs users want a keyboard with the control key next to the A key for comfortable typing.

Control keys also tend to be used heavily in interactive Unix shell input.

[ Reply to This | # ]
This really started in the very early 80's.
Authored by: bentley on Feb 22, '02 05:22:51PM

Before the IBM PC 5150 was released in the burgeoning 80's, many, many keyboards on the wide variety of computing systems available at the time, including minis, had the control key where the caps lock typically is today, and the caps lock where the control key typically is today. I think a Hazeltine terminal keyboard had the control key in the lower left corner, and that stuck out because we all hated that.

Then the IBM PC came out with its boat anchor keyboard; the caps lock and the control keys were in new, awful positions. The placement of these keys for the first IBM PC was not arbitrary, it followed the placement of an earlier IBM product (specifically the caps lock key; the control key was an add-on!) but it was not correct. Unfortunately, the standard stuck like glue, and we've been cursed by this configuration for twenty two years. I absolutely dispise the current placement.

It's really bad now that the worlds of Mac and Unix collide in Mac OS X, where some sequences start with the command key, and others start with the control key, the left hand calisthenics are awful.

I haven't dealt with the problem proactively because I deal with a huge number of different keyboards every day; it would do no good for me to solve the problem on some keyboards and not on others.

[ Reply to This | # ]
UNIX people
Authored by: SeanAhern on Feb 22, '02 09:45:53PM

Short answer: UNIX people like it.

It's more than emacs. When you're using UNIX all the time, you find yourself using things like ^C (kill job), ^U (erase line), ^W (erase word), ^Z (suspend job), and others to do your normal work.

Since I almost never hit Caps Lock, and hit Control all the time, I'd like the Control key to be in an easy-to-access location. Yeah, the lower-left corner isn't bad, but right under my left pinky would be great.

To compound the issue, most people who use UNIX are used to the X11 system, in which you can remap any key to any other key. On every other UNIX computer I've used, I have remapped the Control key to right under my pinky. The Mac is the only computer where I haven't been able to do this.

(I have not tried this hack yet - more precisely, I haven't rebooted yet to see if the changes have taken effect - so I can't comment on its success.)

[ Reply to This | # ]
What's the point?
Authored by: babbage on Feb 22, '02 10:22:01PM
As MacQueen noted, this is an older & still popular configuration for Unix keyboards. I'm not quite that old school -- I grew up with PCs & Macs and don't remember a time when the current configuration wasn't the norm -- but you still see keyboards like that today, particularly with Sun hardware. Maybe others too, but Sun boxes are the only 'true' Unix machines I've worked on at the console (as opposed to telnetting remotely through a PC of some kind).

Personally, I like having all the modifier keys in a row together on the bottom of the keyboard, and don't have a problem reaching down with my pinky for all the ^foo chords that you have to use in Emacs, Vi, Pine, the shells, etc. But, like many things, it's a religious issue for many people, and in the end the right thing is to just allow the user to override anything that might reasonably need to be overridden.

I've never messed around with it, but what does the Keyboards widget in System Preferences let you override? You can set international keymappings, can't you? If so, can't the 'standard Unix set' [provided that such a thing could be agreed upong ;] be added as an option there? Seems like a more robust solution than trial & error of unpublished settings in whatever ~/Library/Preferences/*.plist file would apply here...

[ Reply to This | # ]

Doesn't work on my G4/dual 500
Authored by: SeanAhern on Feb 23, '02 02:08:18PM

Doesn't work for me. I have a dual G4/500, Mac OS 10.1.3, Apple Pro keyboard. The changed made no difference. Yes, I blew away the extensions cache.

I like the "alternate" international keyboard idea that someone mentioned. That's a lot cleaner than hacking the kernel extensions.

[ Reply to This | # ]
PC USB Keyboard
Authored by: catfishami on Feb 26, '02 03:09:05PM

I want to swap the Windows Key, Control and Alt on my PC USB keyboard. I have a USB-KVM (Keyboard, Video, Mouse switch) to use both my desktop PC and my Titanium Powerbook on 1 monitor with the same USB mouse and keyboard. But I keep hitting Alt on the keyboard for command, and Ctrl for Option, but they don't behave like that. What would the keybindings be for all 3 of those to be swapped?

[ Reply to This | # ]
PC USB Keyboard
Authored by: TvE on Sep 22, '03 11:34:03AM

I have a similair situation - PC's and Mac's on the same KVM switch.
I am now using a Logitech Cordless Desktop - and Logitechs' drivers takes care of your problem(!) The ALT-COMMAND-CTRL keys are "swapped" so that they're place where you expect them to be on both platforms!

I have commented about this soultion in another thread on MOSXH - search for USB KVM switch...

PS.: The MX 700 Mouse also works better (on my desks surface) than the other optical mice I have tried!

[ Reply to This | # ]
Authored by: DeltaTee on Feb 26, '02 07:31:25PM

Is there a good key remapper that would allow me just to disable the CAPSLOCK key? I think that the key is a relic of times gone by, and haven't had a need for one in the past 10 years or so.

[ Reply to This | # ]
Easy to get lost
Authored by: Head on Mar 25, '02 09:28:35PM
However, when I looked at my version of the Info.plist file, I found that I did not have the AppleUSBKeyboard key within the IOKitPersonalities key, despite typing this from a USB keyboard!
I got a little sidetracked at first too. Make sure you are looking all the way down in the 2nd Contents directory... it's in there if you're looking at the right file. Otherwise, you're probably in a similar file in the wrong place.

[ Reply to This | # ]
Authored by: mgraeb on Jun 11, '02 11:05:28AM

I just did this under 10.1.5 and the first time there was nothing under the IOKitPersonalities key so i manually added a dictionary, added a AppleUSBKeyboard key with its own dictionary to that, and put the "Swap control and capslock" key in there. then I removed Extensions.mkext and rebooted and:

nothing happened

but when I looked back in Info.plist it had changed itself to look like the walkthrough above and when i did it the second time everything worked.

mystery of mysteries

[ Reply to This | # ]
Swap control and caps lock on USB keyboards
Authored by: miggins on Sep 22, '03 02:56:04AM

This and many of the other requests in this thread are handled by DoubleCommand found at for those who are interested.

[ Reply to This | # ]
Swap control and caps lock on USB keyboards
Authored by: n8gray on Oct 30, '03 01:46:20AM

Note: This hint does NOT work if you use any custom driver for your keyboard. For example, I can't do the swap on my Logitech keyboard with all the fancy internet keys if I install the Logitech driver. uControl worked for me under Jaguar, but hasn't been updated for Panther yet. Until it is I'll be living without fancy internet keys... :-(

[ Reply to This | # ]
Swap control and caps lock on USB keyboards
Authored by: juandesant on Dec 08, '06 02:55:15PM

With Mac OS X 10.4 is even easier: go to the Keyboard and Mouse preference pane, a clic on the Modifier keys… button, and you will be able to interchange Caps Lock and Control, for instance; in my case, I'm interchanging the positions of the Command and Option keys in order to have the keys nearer to the space bar behave as Command keys.

Juan de Dios Santander Vela
Electronics Engineer
Astronomy Software Developer
Ph.D. Student

[ Reply to This | # ]