MainspringGuides › Remap keys
macOS Guide

How to Remap Any Key on Your Mac (No Extra Software)

Updated July 2026 · 3 min read

macOS can rewire your keyboard without any third-party software. Modifier keys — Caps Lock, Control, Option, Command — swap in System Settings; everything else bends to hidutil, a built-in command that remaps keys at the lowest level, before any app sees them. Here's both routes, plus how to make a remap survive reboots — and how to undo everything.

Modifiers: the point-and-click way

  1. Open System Settings → Keyboard → Keyboard Shortcuts…
  2. Select Modifier Keys in the sidebar.
  3. If you use more than one keyboard, pick the right one from the keyboard menu — mappings are per keyboard.
  4. Reassign any of Caps Lock, Control, Option, Command to another modifier, to Escape, or to No Action (which disables the key).

The classic moves: Caps Lock → Escape (beloved by Vim users), Caps Lock → Control (terminal ergonomics), or Caps Lock → No Action (peace). Undo is the same pane — every menu has a Restore Defaults button. Because mappings are per keyboard, you can give an external mechanical board different modifiers than the built-in laptop keys, and each remembers its own arrangement.

Everything else: hidutil

For non-modifier keys, macOS ships hidutil. Each key has a hex usage code of the form 0x7000000XX; you map a source key to a destination key. Example — turn Caps Lock into Escape (the same remap, done the low-level way):

# Caps Lock (0x39) acts as Escape (0x29) — takes effect immediately
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}'

# Undo: clear all hidutil remappings
hidutil property --set '{"UserKeyMapping":[]}'

Useful codes: 0x35 is the §/` corner key, 0x64 the ISO backslash, 0x4A Home, 0x4D End, 0x3A0x45 are F1–F12. The full list lives in the USB HID usage tables (keyboard page 0x07); to disable a key outright, map it to 0x700000000. Multiple remaps go in the array separated by commas. Mistakes are never dangerous — the undo command above instantly restores a stock keyboard, and so does a reboot, because:

hidutil forgets on restart — persist it

Mappings live in memory only — restart the Mac and every key is back to stock, which makes experimentation completely safe. Once a remap has proven itself for a week, make it permanent by having macOS reapply it at every login with a LaunchAgent:

# ~/Library/LaunchAgents/com.local.keyremap.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.local.keyremap</string>
  <key>ProgramArguments</key><array>
    <string>/usr/bin/hidutil</string><string>property</string><string>--set</string>
    <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}</string>
  </array>
  <key>RunAtLoad</key><true/>
</dict></plist>

To retire it, delete that file and run the undo command (or restart). If you'd rather not hand-edit plists, this is the point where a tool like Karabiner-Elements earns its install — but for one or two simple remaps, the built-ins are all you need.

Remaps worth stealing

Check what's currently applied at any time with hidutil property --get UserKeyMapping — an empty result means your keyboard is stock. One scope note: a LaunchAgent runs when you sign in, so the remap isn't active at the login screen after a reboot — if you need it there too, the same plist installed as a system-wide LaunchDaemon in /Library/LaunchDaemons covers that.

Prefer toggles to hex codes?

hidutil is powerful but nobody enjoys HID usage tables. Mainspring gives 90+ hidden macOS settings — keyboard behavior included — the treatment they deserve: labelled, one-click, reversible.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once