15

Whenever I press an option key with any char key, macOS is inserting a special character. For example
⌥ p it inserts π
⌥ w it inserts

How can I disable this ?

Why I want to disable this?

  1. I hardly use these symbols
  2. I extensively use emacs, hence I always prefer shortcuts like
  • ^ A to move cursor to beginning, instead of Home
  • ^ n to next line, instead of
  • ^ K to kill line
    Thus I always use Control + Key for every navigation in text.
    But since mac has some other functionaly for Option + Key I cannot use some thing like, ⌥ w to copy region

4 Answers 4

14

Save the following to ~/Library/KeyBindings/DefaultKeyBinding.dict (create if necessary).

{ "~a" = (); "~b" = (); "~c" = (); "~d" = (); "~e" = (); "~f" = (); "~g" = (); "~h" = (); "~i" = (); "~j" = (); "~k" = (); "~l" = (); "~m" = (); "~n" = (); "~o" = (); "~p" = (); "~q" = (); "~r" = (); "~s" = (); "~t" = (); "~u" = (); "~v" = (); "~w" = (); "~x" = (); "~y" = (); "~z" = (); }

This disables all the ⌥<letter> combinations. Restart apps to take effect.

The DefaultKeyBinding.dict above is an old-style property list1, defining key-value pairs using the syntax { key = value }. In this case, the keys are the key combinations to activate the method in the value.

Standard dictionary key symbols are used: ~ alt, ^ control, $ shift, @ command.
Therefore ~a means ⌥A (alt-A) and ^$1 would be ⌃⇧1 (control-shift-1).

The value for each of the keys is set to ()—empty parentheses without a method. As DefaultKeyBinding.dict overrides /S*/L*/Fr*/AppKit.*/R*/StandardKeyBinding.dict, the shortcut is defined to be without method and therefore does nothing. It's preferable to create your own key bindings file like this rather than editing the system one.

1 Feel free to use a new XML property list style if you prefer—it works the same.

7
  • I am extremely thankful. It was exactly what I wanted. BTW I would appreciate if you could explain what '~' and ( ) do.
    – Kaunteya
    Commented Jul 18, 2015 at 13:45
  • @Kaunteya Edited answer—does that help?
    – grg
    Commented Jul 18, 2015 at 13:56
  • 2
    Does this work for anyone on MacOs? (Sierra?) No effect for me.. Commented Jul 1, 2017 at 7:27
  • 1
    Is this safe to do in Big Sur (v11.0.1)?
    – Bn.F76
    Commented May 15, 2021 at 19:10
  • 1
    In 2023, macOS Ventura, this still is the best solution. Be aware, that you first will need to create the folder mkdir ~/Library/KeyBindings if it is not there, then write to the file ~/Library/KeyBindings/DefaultKeyBinding.dict, then reboot the machine.
    – Václav
    Commented Mar 12, 2023 at 17:54
6

I found that using the Unicode hex input input source (System Preferences > Keyboard > Input Sources, then add source and select Other under languages) worked for me. Found this after trying to change input sources based on @exmaxx's suggestion. NOTE: Using ABC (my default) or US did not solve the problem for me.

2
  • this is the best solution IMO. It solves the problem whilst preserving shortcuts in inserting characters like é by simply switching to the ABC input method.
    – hedy
    Commented Oct 7, 2023 at 8:32
  • Can not believe that there is so simple solution exists, thank you very much
    – sprutex
    Commented yesterday
2

For anyone finding this later and having problems with this.

I was unsuccessful doing this, and the other option with Ukelele has it's own problems (hard to remove default keyboard), so I ended up using BetterTouchTool to replace Option shortcuts with other actions.

1

The solution also might be to use different keyboard layout, e.g. U.S.:

  • problems with "alt" keys: U.S. International, ABC
  • solution: U.S.

Change it in System Preferences -> Keyboard -> Input Sources.


I found the solution on Stack Overflow here so you might give the author a credit if it helped you also ;)

1
  • 2
    didn't work for me though (macOS Monterey 12.6)
    – baggiponte
    Commented Nov 19, 2022 at 12:40

You must log in to answer this question.

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