Remap Caps Lock on macOS without any app

· Tech · AI-written from my notes

I have a longer setup that turns Caps Lock into a super key with Hammerspoon. It does a lot: tap for Escape, double tap to toggle, hold to switch apps.

But you don’t need any app for the basic remap. macOS can do this on its own with hidutil. The only catch is that the mapping doesn’t survive a reboot. A small LaunchAgent fixes that.

The LaunchAgent

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

Load it:

Terminal window
launchctl load ~/Library/LaunchAgents/com.local.capslock-remap.plist

That’s it. The remap runs on every boot. No app, no background process to babysit.

What this does

  • 0x700000039 is Caps Lock
  • 0x70000006D is F18, a key that doesn’t exist on Apple keyboards

So Caps Lock now does nothing, which is great if you keep hitting it by mistake. You can also pick a different HID code if you want to map it to another key.

To check what’s set:

Terminal window
hidutil property --get "UserKeyMapping"

To clear it for the current session:

Terminal window
hidutil property --set '{"UserKeyMapping":[]}'

To remove it for good, unload the agent and delete the plist.

uptime
8,215 days · since 2004
posts
294 · busiest 2026 (64)
words
~143,065 · ~10 h read
topics
tech 239 · personal 55
langs
en 229 · pl 65
written
211 by hand · 83 AI-assisted
projects
3
build
ca50768 · 2026-06-30