Apple - Creating physical escape key on new MacBook Pro with TouchBar by altering .keylayout for § key

  1. Install Karabiner-Elements
  2. Run it form the Launchpad (obviously)
  3. In "Simple Modifications" tab create a mapping "non-us-backlash" to "escape"
  4. Enjoy!

BTW key code for "§" is 0A (as reported by Karabiner Event Viewer)


I found some documentation on Remapping Keys in macOS 10.12 Sierra that works without any third party tools.

To change the key just above tab, set src to 0x64 (Keyboard Non-US \ and |) and dst to 0x29 (Escape). These values should be OR'd with 0x700000000 in the call to hidutil for some reason.

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}]}'

You could put this in a LaunchAgent (~/Library/LaunchAgents/give.me.esc.key.plist) to have it set every time you log in.

<?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>give.me.esc.key</string>
    <key>ProgramArguments</key>
    <array>
        <string>hidutil</string>
        <string>property</string>
        <string>--set</string>
        <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Open System Preferences - select keyboard. Then select Modifier Keys... towards the bottom right of the window.

I have escape assigned to the caps lock key.

enter image description here

I agree using the control keys for escape is poor, but the caps lock key works very well. In practice, I've not really had any issue learning to use the soft escape key. Having caps lock is far faster once I got used to it due to decreased travel distance from the home row.