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.

Can I make a custom keyboard layout (one that wasn’t included with OS X by default) the system default — even for the login screen?

share|improve this question
    
(meanwhile, you could unaccept the answer, it readers might be confused) –  Lohoris Nov 3 '13 at 14:24
1  
@Lohoris: Done! –  Mathias Bynens Nov 3 '13 at 17:59
    
Please update the question b removing the update note, the best answer now works on the latest osx versions as well –  Bert Goethals Jan 21 at 13:20
add comment

3 Answers 3

up vote 5 down vote accepted
+400

This works on OSX 10.9 Mavericks, with a keyboard layout that I created with Ukulele. Assuming that you have the layout already installed in your system, log into your account and make your custom keyboard layout active.

Open a terminal and do the following:

sudo cp /Library/Preferences/com.apple.HIToolbox.plist /tmp/
sudo chmod 777 /tmp/com.apple.HIToolbox.plist
plutil -convert xml1 /tmp/com.apple.HIToolbox.plist

Now you open /tmp/com.apple.HIToolbox.plist in a text editor (e.g. TextWrangler) or in XCode (which has a specialized plist editor).

Throughout the file you will find several mentions of a KeyboardLayout ID key followed by an integer and KeyboardLayout Name followed by a string. Change these strings to the name of your custom keyboard layout and the id integers to the ID of your layout (the easiest way to find the right values is to compare with your user settings found in the file ~/Library/Preferences/com.apple.HIToolbox.plist.

Also the value of the key AppleCurrentKeyboardLayoutInputSourceID must be changed accordingly (probably to something like org.unknown.keylayout.NameOfYourLayout). Again you can find this value in your local preference file.

Once these changes are done, save the file and go back to the terminal. To play it safe, you can create a copy of the original com.apple.HIToolbox.plist file, just in case you made an error and need to roll back. Then do the following:

sudo cp /tmp/com.apple.HIToolbox.plist /Library/Preferences/
sudo chmod 644 /Library/Preferences/com.apple.HIToolbox.plist

Exit the terminal, and restart the computer (logout is not sufficient: the file will not be reread). After restart, you should have your keyboard layout in the login screen.

NOTE: it's possible that it would have been enough to copy the file com.apple.HIToolbox.plist from ~/Library/Preferences/ to /Library/Preferences/, however in my case it has more entries, so I decided to play it safe and just modify the existing file.

share|improve this answer
    
Trying this right now, as the other answer didn’t work. FWIW, here’s what my com.apple.HIToolbox.plist file looks like after the changes: gist.github.com/anonymous/d18bae208b5cf12e48be –  Mathias Bynens Nov 8 '13 at 21:51
    
Worked flawlessly, thanks! I’m sorry I can’t give you the bounty any more, so I’ll just set up a new one just to reward you for this answer. –  Mathias Bynens Nov 8 '13 at 21:54
    
Glad it helped. Thanks for the extra bounty! :-) –  Eric J. Francois Nov 11 '13 at 6:46
    
Worked like a charm. Great tip! –  Kristof Jan 19 at 10:03
    
This is fantastic. I've been bogged down by my Belgian keyboard default to long! I wish i could give you multiple up votes! –  Bert Goethals Jan 21 at 13:21
add comment

I found this old MacWorld tip, that suggested running the Setup Assistant again:

sudo /System/Library/CoreServices/Setup Assistant.app\
/Contents/MacOS/Setup Assistant

At first I thought this wasn’t supported in Lion anymore as running this command didn’t seem to have any effect. Only after posting this question, I noticed there’s a typo in the command. The space characters need to be escaped properly, or the location of the binary needs to be quoted. For this reason, the tip I linked to doesn’t work.

Here’s the correct command:

sudo "/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant"

Alternatively, this would work as well:

sudo /System/Library/CoreServices/Setup\ Assistant.app/Contents/MacOS/Setup\ Assistant

Another gotcha that wasn’t mentioned on the page I linked to: the custom keyboard layout needs to be installed in /Library/Keyboard Layouts/ (i.e. cd /Library/Keyboard\ Layouts), not ~/Library/Keyboard Layouts, for it to appear in the Setup Assistant’s keyboard layout selection screen.


Update: As of OS X 10.8, you’ll need to run an extra command (i.e. remove a file first):

sudo rm /var/db/.AppleSetupDone; sudo "/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant"

Also, you will have to create a new user account in order to complete the Setup Assistant — but don’t worry, you can delete the new account afterwards.

This trick doesn’t work anymore in recent OS X 10.8 versions.


Update: Here’s everything I know about custom keyboard layouts on OS X.

share|improve this answer
    
I followed your steps for the Mountain Lion 10.8 and ran the setup assistant gain set my default keyboard layout to Dvorak and tried to login but it did not work. on reboot it was still using qwerty for the login screen. –  ams Jan 5 '13 at 22:01
    
Yeah, it doesn’t seem to work anymore since OS X 10.8. :( –  Mathias Bynens Nov 1 '13 at 22:21
add comment

I’m using a custom keyboard layout created with Ukelele in OS X 10.8.5. I changed the login screen keyboard layout with the following steps:

  1. Open Users & Groups in System Preferences
  2. Select Login Options from the bottom of the left panel
  3. Check Show Input menu in login window
  4. Go to login screen
  5. Select the preferred layout under Other input sources from the input menu, located at top right
  6. Go back and uncheck the Show Input menu in login window to prevent further changes to the login layout

I found this method far easier than editing some random .plist files and running commands it the Terminal.

This method might require administrative access, as you possibly have to unlock the right pane in step 3. above by clicking the lock icon at the bottom.

Update: Sadly, this doesn’t seem to work on OS X 10.9.

share|improve this answer
    
I’ve awarded you the bounty as this seemed like the best answer, but it doesn’t actually seem to work — it always goes back to the default US keyboard layout. To test this, I’ve used a keyboard layout that allows me to type three symbols with one keystroke, so that I can see how many masked characters appear in the password input box. After applying the steps you mentioned, I could only enter one symbol at a time (as per the US keyboard). –  Mathias Bynens Nov 8 '13 at 21:42
    
Can you describe what doesn't work with OS X 10.9? I am able to follow these steps (I didn't do step 6) successfully when using the Workman layout (found here: workman.deekayen.net). My problem however is that if that layout is selected and I lock the computer, the input menu won't show in the login screen, whereas it's fine if I have Dvorak or something else natively supported by OS X. (i.e. I see the menu and can switch back to U.S. if needed) –  Timothée Boucher Nov 11 '13 at 7:04
    
@TimothéeBoucher My previous comment describes what goes wrong, and how I tested this. –  Mathias Bynens Nov 11 '13 at 13:30
add comment

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.