Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is it possible to remove or disable one of OS X Lion’s default keyboard layouts?

I’m using a custom keyboard layout, and now that I managed to set it as the system-wide default keyboard layout, I’d like to be able to uncheck or remove the built-in “U.S.” keyboard layout that came with OS X. Here’s a screenshot — note that the checkbox is disabled:

Screenshot

In OS X 10.9, this preference pane has been redesigned, but still there’s no way to “remove” the built-in “U.S.” keyboard layout:

Screenshot

Since I never use the U.S. keyboard layout, I’d love to get rid of it, i.e. remove it from the Input menu in the menu bar. How can I do this?


Update: Daniel’s answer doesn’t really answer this question, but it does offer some valuable information regarding this problem:

Mac OS X seems to require at least one keyboard layout that the system recognizes as a “Latin character” layout to be selected.

Assuming this is accurate information (thanks, Daniel!), the question could be rephrased as follows:

How to make OS X consider a custom keyboard to be a Latin character layout?


Update: I just came across something that might help.

share|improve this question
1  
I don't think "Latin" is sufficient. That is easily accomplished in Ukelele by setting the keyboard ID to Roman. I suspect your layout also has to be part of the AppleKeyboardLayouts.bundle in system/library/keyboard layouts. –  Tom Gewecke Mar 28 '12 at 14:30
add comment

8 Answers

up vote 9 down vote accepted
+300
  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.
share|improve this answer
    
This worked flawlessly — I didn’t even have to try the backup plan in your last paragraph. Thank you so much! –  Mathias Bynens Aug 13 '12 at 7:53
1  
Aha, it does seem to work if you restart the computer instead of just logging out and back in (step 4). Thanks! Would you mind posting a new answer with a link to your resource so you can get the bounty? –  Mathias Bynens Nov 2 '13 at 14:05
1  
@MathiasBynens I edited the answer and my website. When I tried the second method again, I also needed to restart to apply the changes. –  Lri Nov 2 '13 at 18:09
4  
Works fine in OS X 10.9 if you restart your computer. However I had to remove also the temporary layout from the plist file and reboot using 'sudo reboot', otherwise the temporary layout was added back on normal reboot. –  Dmitry Dulepov Nov 5 '13 at 20:10
2  
@Lri On 10.9 I had to delete :AppleEnabledInputSources:0 (the old default layout item) and the :AppleInputSourceHistory: dictionary (using PlistBuddy). No reboot, but only logoff necessary. –  RolKau Nov 7 '13 at 22:50
show 2 more comments

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.

share|improve this answer
    
Thanks for your detailed clarification of the problem! –  Mathias Bynens Mar 21 '12 at 13:29
    
@Lri I suspect you are correct, but don't have the hardware to test that. Perhaps there's a reader of this site who can? –  Daniel Lawson Aug 9 '12 at 13:00
add comment

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.

share|improve this answer
1  
Checked: my layout meets those criteria but it is not recognised as a possible default layout. So their engineers did not give the full information or gave incorrect information it seems. –  Dmitry Dulepov Nov 5 '13 at 20:14
1  
@DmitryDulepov It is possible to use it as the default layout, but the button to remove the other still won't be activated; you would have to do that manually (see my comment to Lri's answer –  RolKau Nov 8 '13 at 0:57
    
@RolKau, yes but there are other issues later. If you have more than one layout, the new custom layout will not be available in some apps. For example, you will not be able to switch to it in the AppStore's search bar. At least, I could not. –  Dmitry Dulepov Nov 9 '13 at 5:55
add comment

Here's another idea: A few years ago the bundle(s) for Apple Keyboard Layouts were much easier to edit, and this problem seems to have been solvable:

http://hintsforums.macworld.com/archive/index.php/t-71629.html

Perhaps one could still use the old editable bundle, if you could get one from an old system, in the current OS.

share|improve this answer
add comment

Here is an idea: After making sure the keyboard id of your custom layout is set to Roman, make a custom AppleKeyboardLayouts.bundle which contains only that layout and substitute this for the one that comes with the OS. (I don't know myself what is involved in creating a .bundle)

share|improve this answer
add comment

I just came across something that might help. Here goes:

$ defaults read /Library/Preferences/com.apple.HIToolbox.plist 
{
    AppleCurrentKeyboardLayoutInputSourceID = "com.apple.keylayout.Dutch";
    AppleDefaultAsciiInputSource =     {
        InputSourceKind = "Keyboard Layout";
        "KeyboardLayout ID" = 1337;
        "KeyboardLayout Name" = QWERTY;
    };
    AppleEnabledInputSources =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 26;
            "KeyboardLayout Name" = Dutch;
        }
    );
    AppleInputSourceHistory =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 26;
            "KeyboardLayout Name" = Dutch;
        }
    );
    AppleSelectedInputSources =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 26;
            "KeyboardLayout Name" = Dutch;
        }
    );
}

This is on my system, where my custom keyboard layout (named “QWERTY”) is the default. Note that the KeyboardLayout Name and KeyboardLayout ID properties refer to the ID and name at the start of the .keylayout file.

As you can see, defaults read /Library/Preferences/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID still returns the string "com.apple.keylayout.Dutch". Is there a list somewhere of the available com.apple.keylayout values? Is it possible to get such a value for a custom keyboard layout? ’Cause in that case, we could simply override the property.

Also, the AppleEnabledInputSources, AppleInputSourceHistory, and AppleSelectedInputSources properties all seem to ignore the custom keyboard layout, as their values correspond to the native OS X keyboard layout I originally selected when running Setup Assistant.


Another update: Aha! Seems like there’s another plist file from which we might be able to copy the settings.

$ defaults read ~/Library/Preferences/ByHost/com.apple.HIToolbox.*.plist 
{
    AppleCurrentKeyboardLayoutInputSourceID = "org.unknown.keylayout.QWERTY";
    AppleDateResID =     {
        smRoman = 2;
    };
    AppleEnabledInputSources =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 26;
            "KeyboardLayout Name" = Dutch;
        },
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 1337;
            "KeyboardLayout Name" = QWERTY;
        },
                {
            "Bundle ID" = "com.apple.CharacterPaletteIM";
            InputSourceKind = "Non Keyboard Input Method";
        },
                {
            "Bundle ID" = "com.apple.KeyboardViewer";
            InputSourceKind = "Non Keyboard Input Method";
        },
                {
            "Bundle ID" = "com.apple.inputmethod.ironwood";
            InputSourceKind = "Non Keyboard Input Method";
        }
    );
    AppleGlobalTextInputProperties =     {
        TextInputGlobalPropertyPerContextInput = 0;
    };
    AppleInputSourceHistory =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 1337;
            "KeyboardLayout Name" = QWERTY;
        },
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 26;
            "KeyboardLayout Name" = Dutch;
        }
    );
    AppleNumberResID =     {
        smRoman = 2;
    };
    AppleSelectedInputSources =     (
                {
            InputSourceKind = "Keyboard Layout";
            "KeyboardLayout ID" = 1337;
            "KeyboardLayout Name" = QWERTY;
        },
                {
            "Bundle ID" = "com.apple.inputmethod.ironwood";
            InputSourceKind = "Non Keyboard Input Method";
        }
    );
    AppleTimeResID =     {
        smRoman = 2;
    };
}

As you can see (AppleCurrentKeyboardLayoutInputSourceID), apparently custom keyboard layouts get values like "org.unknown.keylayout.FOO" where FOO is the name of the keyboard layout (as specified in the .keylayout file).

So, to let’s try setting all values to our custom keyboard layout, named QWERTY and with ID 1337 (specified in the .keylayout file):

sudo defaults write /Library/Preferences/ByHost/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID -string "org.unknown.keylayout.QWERTY"

Sadly, this doesn’t seem to work.

Update: @Lri discovered a reliable method — see his answer.

share|improve this answer
add comment

Apple’s response to my bug report, in which I was asking to make it possible to remove the system default keyboard layout if another one is selected through System Preferences:

Engineering has determined that this is not an issue for Apple to address.

Assuming this custom keyboard layout is bundled (.keylayout is inside a bundle like foo.bundle/Contents/Resources/foo.keylayout), then this could be as easy as inserting into the Info.plist's KLInfo_ dictionary:

<key>KLInfo_Qwerty</key>
<dict>
  <key>TISInputSourceID</key>
  <string>com.imgur.stack.keyboardlayout.Qwerty</string>
  <key>TISIntendedLanguage</key>  
  <string>en</string> 
</dict>

If this layout is needed system-wide (i.e. including password input) it could be installed in /Library/Keyboard Layouts/, rather than the same location in ~/Library/.

Please update your bug report to let us know whether this is still an issue for you.

If you have questions regarding the resolution of this issue, please update your bug report with them.

Please be sure to regularly check new Apple products for any updates that might affect this issue. Again, thank you for taking the time to submit bugs. We sincerely appreciate your input.

share|improve this answer
add comment

It can be done easily. First change to your custom layout (use menu bar Input menu), then deselect the U.S. layout.

share|improve this answer
    
My custom layout is the one currently in use. As mentioned in the question, I don’t use the U.S. keyboard layout anymore. –  Mathias Bynens Mar 21 '12 at 13:18
    
I live without U.S. keyboard layout and had no problem to deselect it. The other customizations I have are non-default, non-US region and language. –  shpokas Mar 21 '12 at 13:49
    
Can you deselect the keyboard layout that you chose when setting up the Mac initially? –  Mathias Bynens Mar 21 '12 at 13:56
    
Yes, I can if I change region as well. –  shpokas Mar 21 '12 at 20:42
    
See, that’s the problem. There’s always one of OS X’s built-in keyboard layouts that you cannot delete or disable. –  Mathias Bynens Mar 21 '12 at 20:44
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.