One option would be to create ~/Library/KeyBindings/
and save a property list like this as DefaultKeyBinding.dict
:
{
"~M" = noop:;
}
It doesn't work in some applications (like Xcode, Terminal, or Firefox) though.
You could also create a new keyboard layout with Ukelele.
- Choose File > New Based on Current Input Source.
- Remove the output of alphanumberic keys under option and option and shift. If you remove the keymaps completely, some key combinations like ⌥← and ⌥⌫ won't work.
- Save the keyboard layout as bundle or XML to /Library/Keyboard Layouts/. Keyboard layouts in the user library can't be selected in password dialogs or the login window. The popovers shown when holding keys only work with the bundle format.
- Log out and back in.
- Enable the input source in System Preferences.
You can disable all other input sources by editing the HIToolBox plist.
To apply changes to the keylayout file, run sudo touch /Library/Keyboard\ Layouts/
and log out and back in.