Apple - How to remove or disable a default keyboard layout?

  1. Enable an input source that is not like your physical keyboard layout from System Preferences (I used Afghan Dari).
  2. Run f=~/Library/Preferences/ByHost/com.apple.HIToolbox*.plist; plutil -convert xml1 $f; open $f -e.
  3. Remove other input sources except the temporarily enabled keyboard layout and your custom keyboard layout.
  4. Log out and back in.
  5. Remove the temporarily enabled keyboard layout from the property list.
  6. Log out and back in.

Edit: the method above seems to have stopped working in 10.9. This worked in both 10.9 or 10.8 though:

  1. Change the current input source to your custom keyboard layout.
  2. Open ~/Library/Preferences/com.apple.HIToolbox.plist (in 10.9) or ~/Library/Preferences/ByHost/com.apple.HIToolbox.*.plist (in 10.8 and earlier). You can convert the plist to XML with plutil -convert xml1.
  3. Remove the input source or input sources you want to disable from the AppleEnabledInputSources dictionary. If there is an AppleDefaultAsciiInputSource key, remove it.
  4. Restart.

It appears that you cannot do what you want to without some yet-undiscovered hack to the system. Mac OS X seems to require at least one keyboard layout that the system recognizes as a "Latin character" layout to be selected. This prevents your from being unable to enter your password at the login screen, etc. If you selected French, or Canadian, or another keyboard layout that the system recognizes as Latin characters, you can deselect the US layout.

Your problem is that your custom layout, while containing Latin characters, is not recognized by the system as a Latin keyboard layout, and thus cannot be the only selected keyboard layout. See this question (sadly lacking a great answer) for more information.

Note that a great answer to this question would answer your question also. Alas, my answer here only clarifies what the problem is, but I have no step-by-step solution for you. While such a hack may be possible, I see no evidence that anyone has figured out how to convince Mac OS X that a particular custom keyboard is safe to use as the sole selectable keyboard.


For the sake of completeness, I filed this as bug ID #11137961 with Apple, and this is the response I got:

Bug ID #: 11137961
Bug Title: Allow disabling default (built-in) keyboard layouts when using a custom one


Engineering has determined that this issue behaves as intended based on the following information:

If the issue is just getting your keyboard layout recognized as ASCII-capable, the easiest would be to "bundle" your .keylayout, then your Info.plist can contain a "KLInfo_" dictionary that further describes it, like:

 <key>TISIntendedLanguage</key>
 <string>en</string>   # BCP 47 language string

I'd need to look into this a bit more, but it looks like TIS will scan the keyboard layout output to produce a USet and produce an initial idea of ascii-ness by whether it passes the following minimal test:

 uset_containsRange(uSet, 0x0020, 0x0021) && uset_containsRange(uSet, 0x002C, 0x0039) &&
 uset_containsRange(uSet, 0x003F, 0x005A) && uset_containsRange(uSet, 0x0061, 0x007A);

TIS will also examine the exemplar set for the above indicated locale and require a good dozen or so characters in the range [a-z].

For some suggestions on bundling a .keylayout, also see TextInputSources.h.

If this is still an issue, or you have questions regarding the resolution of this issue, please update your bug report with that information.

We are now closing this bug report.

Tags:

Macos

Keyboard