I would like to switch the Right Command (⌘) Key order with the Alt Key under the System Preferences (to be just like Windows) but there appears to be no option under System Preferences.

Does anyone know how to move these keys' locations using Karabiner-Elements or some other software? In this case we would swap the right-hand Alt and Command keys.

Modifier Keys in System Preferences


Apple's Technical Note TN2450 describes how to remap keys. It is important to know that Right Command is also Right GUI. Running the following command will switch Right Command and Right Alt (if you also want to do the Left Command and Left Alt, refer to the technical note to get the hex values and the Python code below to do the or operation).

hidutil property --set '{"UserKeyMapping":

The table at the bottom of the Technical Note has a list of hex values for each key. To generalize the above answer to switch any keys (at least is macOS Sierra), you must or the hex value from that list together with 0x700000000. The following Python code demonstrates one way to do this.

In [1]: def convert(val):
   ...:     int_val = int(val, 16)
   ...:     ref = '0x700000000'
   ...:     int_ref = int(ref, 16)
   ...:     return hex(int_ref | int_val)

In [2]: r_alt = '0xE6'

In [3]: print(convert(r_alt))

A more general and user-friendly approach is to use Karabiner-Elements, which is a version of Karabiner that works on Sierra.

Karabiner-Elements allows for your specific use case (that's how I use it) in addition to almost any other kind of key remapping.

My configuration looks likeenter image description here

  • I'm currently using Karabiner Elements to map right command key to right option (alt) key. I suggest you download and test - maybe the author just hasn't updated your issue (there are over 400 issues logged). – mikaraento May 20 '17 at 18:36
  • Could you post your configuration then? That is what I stated in the question. – William May 20 '17 at 18:49
  • Here you go, I added an image to the answer. – mikaraento May 22 '17 at 20:34

Do you want to swap Option (Alt) with Command or Control with Command?

See Changing modifier keys from the command line

  • Right Command and Right Alt should be swapped – William Apr 20 '17 at 0:14

You must log in to answer this question.

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