I use a Mac as a development box, but am slowly transitioning to Linux. So I am spending the majority of my time in the Linux guest VM while working. But I still spend a fair amount of time in Mac OS X, for things like email and such.

One issue I am having is changing contexts between the two keyboard layouts. I'm constantly hitting the other OS's keyboard shortcut to go to the start of a terminal line, or getting Command-C and Ctrl-C mixed up depending on what OS I am in.

Can anyone point me in the right direction to bring the Mac OS X and Linux (am using CentOS 6.3) basic OS keymappings into alignment? Since my ultimate goal is to move from OS X to Linux entirely, I would prefer changing OS x to match Linux, but am open to other alternatives.

  • I am hoping there is something that works at a global level, as opposed to changing keymappings for all the different apps I may interact with. Nov 26 '12 at 13:03
  • 1
    I would suggest that as you wish to change the shortcuts of Mac OS, asking that the question will be moved to the "Ask Different" site will have a higher chances of getting your answer. You could edit and change your question here to ask for a list of shortcut keys to do a list of actions you are looking to replace and this will get you a "Linux" answer.
    – Didi Kohen
    Nov 26 '12 at 13:52
  • I don't think it's a good idea to develop muscle memory that conflates Ctrl and Command (the four-leaf-clover symbol). They don't mean the same thing at all, despite Microsoft's attempt to convince us otherwise ever since WIndows 2.x or so. Oct 3 '15 at 1:02

After experimenting a lot and going through all kinds of complicated configurations that are very hard to get right and to maintain, I found the following simple solution.

  1. In MacOS, switch Alt and Cmd: Settings/Keyboard/Special Keys. Option becomes Command. Command becomes Option.

  2. In Linux, make Cmd (super) a second Ctrl key: Create ~/.Xmodmap with:

remove mod4 = Super_R

remove mod4 = Super_L

add Control = Super_R

add Control = Super_L

Make sure you source .Xmodmap in .bashrc with:

$xmodmap .Xmodmap

The result is that the special keys are in the order you find them on any keyboard: CtrlWin/CmdAlt. I admit that having no super in Linux is a weak point, but it is easy to live without.

But the real magic is that all those commands that utilize ctrl in Linux and that utilize cmd in MaxOS are now mapped to the same physical key:


are now all performed with the same physical key combination.

This took away 80% off my annoyances while it is simple enough and does not mess to much with default keys that make sharing my laptop hard (pair programming).

I created little stickers to indicate the changed mapping: https://twitter.com/ejgroene/status/270933843765260289/photo/1

  • Aren't you going to regret this the first time you try to copy text from a Terminal window on OS X and instead hit ctrl-C and interrupt some important process? :) Oct 3 '15 at 1:01

KeyRemap4MacBook looks like it should do what you need. It's free and open source, and seems to have received good reviews.

  • Thanks, this looks like something worth investigating. I'll install it and post feedback afterwards. Nov 27 '12 at 12:00
  • @LanceWoodson Did you ever look into KeyRemap4MacBook? Oct 3 '15 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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