IN THIS ARTICLE
- Which way should you remap keys on a Mac?
- How do you swap modifier keys in System Settings?
- How do you remap any key with hidutil?
- How do you keep a hidutil remap after a restart?
- How do you remap only your external keyboard?
- How do you remap keys inside a Keychron keyboard?
- Frequently asked questions
To remap keyboard keys on a Mac, open System Settings > Keyboard > Keyboard Shortcuts > Modifier Keys and change modifier keys such as Caps Lock, Control, Option, and Command there. For any other key, use the built-in hidutil command, a remapping app, or a keyboard that saves the new layout in its own memory.
Quick answer
- If you only want to swap modifier keys such as Caps Lock or Command: use System Settings. It takes no install.
- If you want to change any other key without an app: use hidutil in Terminal. Add a LaunchAgent so it returns after a restart.
- If you want the change on every Mac you plug into: remap it inside the keyboard. On the Keychron Q6 Max, you do this in Keychron Launcher, opened in Chrome, Opera, or Edge with the keyboard connected by USB cable.
- If you want to undo the Mac-side remaps: click Restore Defaults in System Settings, and clear hidutil with one command.
Which way should you remap keys on a Mac?
Short answer: pick by the key you want to change and by where the change should live.
System Settings, hidutil, and a remapping app all change the key on the Mac. Keychron Launcher changes it in the keyboard, before the Mac sees it.
| Method | Keys you can change | Install anything? | After a restart | On another Mac |
|---|---|---|---|---|
| System Settings | Modifier keys, such as Caps Lock and Command | No | Kept | Separate setup per Mac |
| hidutil command | Any key with a usage ID | No | Lost, unless a LaunchAgent runs it | Separate setup per Mac |
| Remapping app | Depends on the app | Yes | Kept if the app starts at login | Separate install per Mac |
| Keychron Launcher | Any key on the board, including fn | No, it runs in the browser | Kept on the keyboard | Carried in the keyboard |
A remapping app makes sense when you want a menu instead of commands, or rules per app. The app has to be running for the remap to work.

An illustration drawn for this guide, not a screenshot.
If the key you want is not a modifier, skip System Settings and go to hidutil or Launcher.
How do you swap modifier keys in System Settings?
Short answer: open the Modifier Keys pane and choose a new action for each key.
On macOS Sonoma or later, follow these steps:
- Choose Apple menu > System Settings, then click Keyboard in the sidebar. You may need to scroll down.
- Click Keyboard Shortcuts, then click Modifier Keys in the list on the left.
- If your Mac shows a keyboard menu at the top of the pane, choose your external keyboard there.
- Click the pop-up menu next to the key, such as Caps Lock. Choose Control, another modifier, or No Action.
To go back, open the same pane and click Restore Defaults.
On a keyboard made for Windows, Alt acts as Option and the Windows logo key acts as Command. To get Command next to the space bar, set the Option key to Command and the Command key to Option in this pane.
Check: this pane only lists modifier keys. Letters, numbers, and the function row are not in it.
How do you remap any key with hidutil?
Short answer: run one hidutil command in Terminal with the code of the old key and the new key.
hidutil has been built into macOS since 10.12 Sierra. Each key has a usage ID. Combine it with 0x700000000, so Caps Lock (0x39) becomes 0x700000039, and F13 (0x68) becomes 0x700000068. Left Control is 0xE0, Left Option is 0xE2, and Left Command is 0xE3. Apple's TN2450 note lists the rest.
This command turns Caps Lock into F13.
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000068}]}'
To undo every hidutil remap, run this:
hidutil property --set '{"UserKeyMapping":[]}'
Check: without extra options, the remap applies to every keyboard on the Mac, including a MacBook's built-in one.
How do you keep a hidutil remap after a restart?
Short answer: save the same command in a LaunchAgent, so macOS runs it each time you log in.
Apple's note says hidutil remaps are lost when the Mac restarts. They are also lost when the last keyboard disconnects.
A LaunchAgent is a small property list file in the Library/LaunchAgents folder of your home folder. macOS reads that folder when you log in. Save this as ~/Library/LaunchAgents/com.example.remap.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.remap</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--set</string>
<string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000068}]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Log out and back in to load it. To stop it, delete the file and run the undo command above.
When you change the remap later, edit the last string line in this file as well.
How do you remap only your external keyboard?
Short answer: in Terminal, add the keyboard's VendorID and ProductID to the hidutil command.
Run hidutil list in Terminal and find your keyboard by name. Note its VendorID and ProductID. Connected by cable, the Keychron keyboards in this guide use VendorID 0x3434. Then add both to the command with --matching:
hidutil property --matching '{"VendorID":0x3434,"ProductID":0xYOURID}' --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000068}]}'
Replace 0xYOURID with the ProductID from the list. Your MacBook keyboard keeps its normal layout. A remap limited to one keyboard with --matching can be lost when that keyboard disconnects, so run the command again after you reconnect it, or log out and back in if you use a LaunchAgent. Over Bluetooth or a receiver, the keyboard may show up as a different entry, so run hidutil list again in each mode you use.
A remap made in the keyboard itself never touches the built-in keyboard, because the Mac is not changing anything.
For a LaunchAgent, put --matching and its value in as two extra string lines before --set.
How do you remap keys inside a Keychron keyboard?
Short answer: open Keychron Launcher in your browser, select Layer 0, click a key, and pick its new function.
The Q6 Max, Q1 Max, and K3 Max run QMK firmware. Keychron Launcher is our browser-based remapping tool for them. The new keymap is saved on the keyboard, so it stays after a restart and works on another Mac with no app.
On all three, a system toggle on the keyboard picks Mac or Windows. Layers 0 and 1 are for Mac, and Layers 2 and 3 are for Windows. With the switch in the Mac position, Layer 0 is active.
- Slide the system toggle to Mac.
- Connect the keyboard to your Mac with a USB data cable.
- Open Keychron Launcher in the latest Chrome, Opera, or Edge. Click Connect and select the keyboard.
- Click Keymap on the left, then select Layer 0.
- Click the key you want to change. It turns red when selected.
- Pick the new function in the tabs below: Basic, Media, Macro, Special Keys, Lighting, Custom, or Layer. Custom holds the Mac keys LOpt, ROpt, LCmd, and RCmd.

This screenshot is from an earlier Launcher version, shown on a white K3 Max. Some tab names have changed since: Special Key is now Special Keys.
Click Export to save the keymap as a file. Click Reset to return to the default keymap. Our Launcher remap guide explains each tab.
On the Mac layer of these three boards, the keys left of the space bar already send Control, Option, and Command. The fn key is a layer key inside the keyboard, so macOS never receives it. To change fn, use Launcher.
Check: when modifier keys act strangely, the system toggle may not match your computer. Launcher warns about this too.
Frequently asked questions
How do I remap keys on a Mac without third-party software?
Use System Settings for modifier keys such as Caps Lock and Command. Use the hidutil command in Terminal for other keys. A Q6 Max, Q1 Max, or K3 Max can also be remapped in Keychron Launcher, opened in Chrome, Opera, or Edge with the keyboard connected by USB cable.
Why does my key remap reset after I restart my Mac?
A hidutil remap lasts only until the Mac restarts or the keyboard disconnects. Save the command in a LaunchAgent, or remap the key inside the keyboard.
How do I swap Command and Option on a Windows keyboard connected to a Mac?
In System Settings > Keyboard > Keyboard Shortcuts > Modifier Keys, set Option to Command and Command to Option. On the Q6 Max, Q1 Max, or K3 Max, slide the system toggle to Mac instead. Our Mac connection guide covers the rest of the setup.
References & Citations
- Steps for changing what Caps Lock, Control, Option, and Command do, and Restore Defaults. (Apple Support: Change the behavior of the modifier keys on Mac)
- Mac keyboard shortcuts, including which keys stand in for Option and Command on keyboards made for Windows PCs. (Apple Support: Mac keyboard shortcuts)
- The hidutil UserKeyMapping property, keyboard usage IDs, and when remappings are lost. (Apple Technical Note TN2450: Remapping Keys in macOS 10.12 Sierra)
- How launchd loads user agents from the LaunchAgents folder at login, and the required property list keys. (Apple Developer: Creating Launch Daemons and Agents)
- A walkthrough of hidutil list, per-keyboard matching, resetting the map, and a LaunchAgent. (GitHub Gist: Guide on how to remap keyboard keys on macOS)
- Remapping a key in Keychron Launcher, with each function tab explained. (Keychron: How to Remap a Key on Launcher)
- The four key layers on the K3 Max, two for Mac and two for Windows, and the system toggle. (Keychron K3 Max user manual (PDF))
Browse Keychron custom keyboards →·Browse the Keychron blog →






