Created
January 25, 2026 15:04
-
-
Save remjx/cdeac85b60dea2b3d9be507125a17b16 to your computer and use it in GitHub Desktop.
caps lock to backspace key remapping script for mac os
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Caps Lock → Backspace remapping using hidutil | |
| # Create the LaunchAgent directory if it doesn't exist | |
| mkdir -p ~/Library/LaunchAgents | |
| # Create the plist file | |
| cat > ~/Library/LaunchAgents/com.local.KeyRemapping.plist << 'EOF' | |
| <?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.KeyRemapping</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>/usr/bin/hidutil</string> | |
| <string>property</string> | |
| <string>--set</string> | |
| <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x70000002A}]}</string> | |
| </array> | |
| <key>RunAtLoad</key> | |
| <true/> | |
| </dict> | |
| </plist> | |
| EOF | |
| # Load it now (so you don't have to reboot) | |
| launchctl load ~/Library/LaunchAgents/com.local.KeyRemapping.plist | |
| # Also apply immediately for this session | |
| hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x70000002A}]}' | |
| echo "Done. Caps Lock is now Backspace." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment