9

I want to remap § to ` and ± to ~ on my Mac keyboard because they are located in a place I am not used to. Is there an easy way to do this?

7

The two apps most commonly used to do this are

Ukelele

and

Karabiner

There’s a lot of other options, but these are the easiest in practice for most people to just manage their layouts easily.

| improve this answer | |
  • Found it here: github.com/tekezo/Karabiner-Elements/blob/master/usage/… – mahdix Apr 20 '17 at 16:49
  • There's also the possibility that OP has selected the wrong keyboard layout on the input menu. – WGroleau Sep 30 at 17:25
  • @WGroleau I've not seen any alternative input source that would do that. Perhaps you know of one? This exchange is typical of someone shifting from a US ANSI English keyboard, where `/~ is on the topmost leftmost key, to a European English ISO keyboard, where it moves to the bottom leftmost key. Or vice versa. – Tom Gewecke Sep 30 at 17:59
  • Well, you just mentioned two keyboards that relocate the key OP is concerned with. – WGroleau Sep 30 at 18:09
  • @WGroleau You are confusing hardware with software. ANSI and ISO are differnet kinds of hardware keyboard, not keyboard layouts, and you can't select them in the input menu. Any given keyboard layout you select in the input menu will look slightly different depending on which kind of hardware you have attached, because ISO has one key more than ANSI. – Tom Gewecke Sep 30 at 20:11
3

https://github.com/tekezo/Karabiner-Elements/blob/master/usage/README.md#how-to-configure-karabiner-elements

Here is explains "EXACTLY" the problem that I am having with a simple solution.

You need to update karabiner.json and add this part:

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "non_us_backslash": "grave_accent_and_tilde",
                "grave_accent_and_tilde" : "non_us_backslash"
            }
        }
    ]
}
| improve this answer | |
3

Remapping § to ` and ± to ~ worked on my Mac (running OS X 10.15.6) without additional software with the following code snippet.

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

To do this automatically at startup, I use a launchctl script called com.user.loginscript.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.user.loginscript</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/hidutil</string>
        <string>property</string>
        <string>--set</string>
        <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035, "HIDKeyboardModifierMappingDst":0x700000064}, {"HIDKeyboardModifierMappingSrc":0x700000064, "HIDKeyboardModifierMappingDst":0x700000035}]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

The file needs to be registered with a one-off execution of the following command:

launchctl load ~/Library/LaunchAgents/com.user.loginscript.plist

See also this solution which explains how to use Automator instead of launchctl.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .