How to disable typing special characters when pressing option key in Mac OS X?

You can create a custom keyboard mapping with option-letters all set to BLANK using online tool from this webpage. You can create a custom mapping in several clicks out of almost any keyboard layout. Proved to work on MacOSX 10.7+ with IntelliJ Idea, Php/WebStorm, NetBeans, Eclipse.

Select "Set blank for option key" radio in the form, submit the form, and download a patched keyboard layout with "option" key feature disabled. I'm sharing the working file for standard US English keyboard layout:

  • MacOS <= 10.10
  • MacOS >= 10.11

After enabling this custom mapping, if you type a letter with "option" key pressed, nothing is printed to text output. But, the "option key press" is triggered by OS, and detected by your IDE. So you get exactly the same behaviour as you have for other command keys!

  1. Download the key mapping file My Layout.keylayout.
  2. Move it to ~/Library/Keyboard\ Layouts/
  3. Open System Preferences -> Language & Text
  4. Go to Input Sources -> (hit +) -> Select Others
  5. You should find My Layout in the list and select it.

Step 4 can change slightly across MacOS versions. Please be patient to find keyboard layouts list in the settings.


Here are detailed steps to Sebastian Zaha's answer. (I ended up fumbling around a bit before I got this working).

(Alternatively here is a ready made file by me)

  1. Download Ukelele
  2. You can run it directly from the .dmg file
  3. File -> New Based On Current Input Source (I had US selected)
  4. Click Modifiers button
  5. Select each modifier from list that have Left Down or Right Down in the Option column. (There could be some like Either Down OR Up too, but AFAIK you can leave those.)
    • Press the minus button for each like this
  6. Go to Keyboard menu -> Set Keyboard Name
  7. Change the name somehow to make it easier to identify
  8. Go to File -> Save as
  9. Save to ~/Library/Keyboard\ Layouts/ with suffix .keylayout
  10. Log out from your Mac OS account
  11. Log back in
  12. Go to System Preferences -> Keyboard -> Input Sources
  13. Hit the + button -> Others -> Your new layout should be available
  14. Add the new layout
  15. Possibly leave original keyboard layout too and configure some nice way to switch

I was having the exact same problem, in the exact same IDE.

The solution to this is to download Ukulele from here:

http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele

In the application you can create a new keylayout using File -> New from current source. Pressing Option will show you in the place for Option-b a red colored key - meaning it's a dead key. Double clicking it will allow you to change it from a dead key to an output key. When prompted for the output you can put in the same thing (by pressing Option-b).

Thus it will output the same character but will not be considered a dead key, so Intellij can bind it as a shortcut.

To enable your new layout you must save it into your ~/Library/Keyboard Layouts (it helps if you give it a new name with Keyboard -> Set Keyboard Name), and then enable it from System Preferences -> Language & Text.

Tags:

Macos