Each key on your keyboard is mapped to a particular function. While alphanumeric and symbol keys work independently, modifier keys work in conjunction with other keys. For example, pressing A key will type small letter a while holding Command (modifier) and pressing A will select all the content. If you want to change the default key mapping and remap keyboard keys in Mac, here is how you can do that.
Why to Remap Keys in Mac?
There are at least two good reasons I can think of:
- You are using different external keyboard with Mac or using Windows ARM installation on your Mac. In these cases, control and command modifier keys will create lot of confusion due to their location on the keyboard.
- Sometimes one or two keys on your keyboard may stopped working and you do not want to purchase a new keyboard.
Whatsoever is the reason, macOS allows you to remap the modifier keys using default settings. However, you need a third-party app for remapping other key functions.
1. Changing Modifier Key Mapping in Mac
Follow the below steps to change the modifier key mappings:
- Click Apple logo located on top right corner of the screen and select “System Settings…” from the menu.
- Go to “Keyboard” section and click on “Keyboard Shortcuts…” button.
- It will show a pop-up and go to “Modifier Keys” section from the left sidebar.
- If you have multiple keyboards, click “Select Keyboard” dropdown and make sure to select the correct keyboard for which you want to change the mappings.
- Click the dropdown against each modifier key and select different function from the list. For example, you can remap “Control” key function to “Escape” or “Command”.
- Click “Restore Defaults” button to revert back the modifier keys to their default functions.
The available modifier keys include Caps Lock, Control, Option, Command and Globe (Shift key is not available). You can change the mapping of these keys to use one of the functions like Caps Lock, Control, Option, Command, Globe, Escape or No Action. Navigate through other sections and change the default keyboard shortcuts in Mac like switching language, opening Spotlight Search, etc.
Remember, you can assign the Globe key function in “Keyboard” settings page as shown in the below picture.
2. Change Mapping of Any Keyboard Key Function in Mac
The above option does not allow you to remap letters, numbers, punctuation or other symbol keys on your keyboard. If you want to have complete flexibility, then follow the below steps using a third-party app called Karabiner-Elements.
2.1. Install Karabiner-Elements App
- Go to Karabiner-Elements website and click the “Download” button.
- The app is available for different macOS versions (from 10 to latest) and make sure to select the download file for your macOS version.
- This will download .dmg file, open it and extract to .pkg file.
- Open the .pkg package installer file and follow the installation wizard to install Karabiner-Elements app on your Mac.
2.2. Providing Permissions for the App
After installation, open the app and you will be prompted to provide permissions for monitoring input events. Click the “Open Privacy & Security System Settings…” button.
This will open Mac Settings app (System Preferences in older version) where you can enable the permissions by turning on the options. Note that you need to provide administrator credentials for turning on these items.
After that, the app will ask you to allow Karabiner-VirtualHIDDevice-Manager system software. Click the “Open Privacy & Security System Settings…” button again.
You will see macOS blocked the app from loading. Click “Allow” button and confirm the action with your admin password.
You will see a prompt for setting up your keyboard and simply click “Quit” button.
2.3. Changing Key Mappings
Finally, open the app and you will see your keyboard and mouse are showing under “Simple Modifications” section.
- Select your keyboard from the list and click on “Add item” button.
- The app will show “Source” and “Destination” dropdowns for changing key mapping. Let me map the right shift key to number 1 as an example.
- Click the first dropdown and choose the source key. You can select the right_shift key from the “Modifier keys” section.
- Now, click on the second dropdown and choose your destination key. Go to “Number keys” and select 1.
- That’s it!!! You have changed the key mapping on your keyboard.
2.4. Testing New Key Mapping
Open any app like Pages or TextEdit and press the source key you have added in the list. You should see it works for the destination function mapped in the app. In my case, pressing right shift key acts as number 1 when typing.
2.5. Available Keys for Mapping
You can add as many as mappings by clicking on “Add item” button. It is also possible to disable any key by selecting it from first dropdown and then choosing “Disable this key > vk_none” option from second dropdown. You can even change the mapping of mouse buttons to any keyboard key and vice versa. Here is a complete list of keys you can map with Karabiner-Elements app.
- Modifier keys – fn, Caps Lock, left and right – Shift, Control, Command and Option.
- Controls and symbols – enter, backslash, slash, colon, semicolon, equal, escape, delete, tab, hyphen, spacebar, left/right brackets, quote, tilde, comma and period.
- Arrow keys – left, right, up and bottom arrow keys, page up, page down, home and end.
- Letter keys – a to z.
- Number keys – 0 to 9.
- Function keys – F1 to F24.
- Media controls – rewind, play/pause, mute, fast forward, increase/decrease volume, eject, Touch ID and Lock Key.
- Keypad keys – all keys on the extended number pad or keypad like enter, numbers, slash, asterisk, etc.
- Keys in PC keyboards – Windows PC keyboard keys like print screen, scroll lock, pause, insert, help, power, undo, etc.
- International keys – international 1 to 9 and language 1 to 9 keys.
- Japanese – special Japanese PC keys.
- Mouse buttons – various mouse buttons.
- Application Launch keys – all “al_” keys for login, dictionary, alarms, etc.
- Generic GUI Application Control keys – home, back, forward, refresh and bookmarks.
- Remote control buttons – like menu up, down, left, right, etc.
- Others – special keys like number lock, cancel, etc.
After creating the mapping, anytime you can go back to the app and click the trash icon showing against the mapping to delete it instantly.
2.6. Other Key Mapping Functions in Karabiner-Elements
In addition to changing keyboard and mouse mappings, you have so many other options in the app. Go to “Function Keys” section to edit the default mapping of all function keys in your keyboard. Similarly, go to “Complex Modifications” section and click “Add rule” button to add custom available key mapping rules. As you can see, it is possible to simply remap Caps Lock key to “Command + Control + Option + Shift” keys.
2.7. Uninstalling and Deleting Karabiner-Elements App
If you want to delete or uninstall the app, go to “Uninstall” section in the app interface and click “Launch uninstaller” button.
The app will revoke system software permission you have provided and delete the files and ask you to confirm each action with admin password.
Provide your admin password to confirm the action and finally you will see a success message that the app is uninstalled. Restart your Mac to completely remove all app files from your system. After that, you may need to manually disable input monitoring permissions from your privacy settings.
If you do not want to uninstall the app, simply click the icon showing on the top menu bar and select “Quit” option. This will close the app and disable all key mappings you have created. You can relaunch the app anytime later and start using the mappings.
Note: The app also will install Karabiner-EventViewer app when you install Karabiner-Elements. Uninstalling like above will delete both the apps from your Mac.