Skip to content

Instantly share code, notes, and snippets.

@potados99
Created September 10, 2025 16:00
Show Gist options
  • Save potados99/73e902a1a676067d1bc1e61072366ad0 to your computer and use it in GitHub Desktop.
Save potados99/73e902a1a676067d1bc1e61072366ad0 to your computer and use it in GitHub Desktop.
mkdir -p /Users/Shared/bin
echo '''#!/bin/sh\nhidutil property --set '\'{\"UserKeyMapping\":\[\{\"HIDKeyboardModifierMappingSrc\":0x7000000e6,\"HIDKeyboardModifierMappingDst\":0x70000006d\}\]\}\''''' > /Users/Shared/bin/right-option-to-f18-key-mapping
chmod 755 /Users/Shared/bin/right-option-to-f18-key-mapping
sudo cat<<: >/Users/Shared/bin/right-option-to-f18-key-mapping.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>Right Alt(Option) to F18</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Shared/bin/right-option-to-f18-key-mapping</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
:
sudo mv /Users/Shared/bin/right-option-to-f18-key-mapping.plist /Library/LaunchAgents/right-option-to-f18-key-mapping.plist
sudo chown root /Library/LaunchAgents/right-option-to-f18-key-mapping.plist
sudo launchctl load /Library/LaunchAgents/right-option-to-f18-key-mapping.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment