A tutorial on re-mapping dead keys on macOS keyboard layouts
Depending on the macOS keyboard layout you're using, you might have “dead keys”. A dead key represents a symbol which isn't a full character, and therefore isn't immediately inserted into the text when typed. Examples of dead keys are
~. For instance, when typing
` followed by
a, macOS will insert
For programmers, this behavior is often undesirable. For example, the tilde (
~) is a useful shortcut for the
$HOME shell variable, and the backtick (
Fortunately, reconfiguring your keyboard layout to remove these dead keys is relatively easy. The Ukelele app can help you with this task:
- Download and install Ukelele from its website or using
brew cask install ukelele.
- Open the Ukelele app.
- In the application menu, select
New From Current Input Source. This will detect your keyboard layout and create a copy which you can modify.
- In the main window, Ukelele displays your layout with the dead keys highlighted in red. Right-click each of your dead keys, select the corresponding modifier key if necessary (e.g. the shift or option key) and enter the key's value at the bottom of the dialog. This will change the key's behavior to insert the symbol right away.
- Once you've re-mapped all dead keys, save your keyboard layout and copy it to the
- Reboot your Mac.
- Open the System Preferences and navigate to
+. Your custom keyboard layout can be found under the language it's based on. You can now add your new keyboard layout and activate it from the menu bar.