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:
launchctl load ~/Library/LaunchAgents/com.local.capslock-remap.plistThat’s it. The remap runs on every boot. No app, no background process to babysit.
What this does
0x700000039is Caps Lock0x70000006Dis 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:
hidutil property --get "UserKeyMapping"To clear it for the current session:
hidutil property --set '{"UserKeyMapping":[]}'To remove it for good, unload the agent and delete the plist.