Sunday, January 5, 2014

Change the default keyboard of OSX login screen permanently

This has been bothering me real bad. Ever since installing Mavericks, the default login keyboard at the Apple login screen seems to be the standard US (QWERTY). Since I live in the AZERTY world, this ain't no good at all. For the months I been using Mavericks, this proved a real pain in the b*%+/. Unfortunately,  I been rather lazy to go find out how to fix the issue. Solutions from 'misery loves company' alike fora weren't actually forthcoming either... On the long run, I even got used fooling OSX, typing on an AZERTY keyboard, and pretending it was on QWERTY; it ain't such a smart feat, however. Problem is, when you just happen to login early in the morning, you're kind of brain-dead... mostly turns out that you don't wanna make your brain work yet, and it's a nuisance to realize, after a few 'wrong password' pop-ups, that you been typing on a different keyboard that the computer thought you oughtta be using. 

In the beginning I kinda 'helped' the problem by following these instructions by Apple itself. They make a default login keyboard menu item appear at the right-up corner of the toolbar at the top of the monitor. However, this seems to always be the US standard, regardless whether, after booting, keyboards will revert to the versions users specify in their Preferences 'Language and Region' panes. With Apple's solution, you needed to select first the correct keyboard from the drop-down and then to login. Worth noticing, there's no other predefined keyboards than the US at this login screen, so you need to seek yours inside an ethnic list of keyboards first, and then select it to type your credentials and login. Quite a fuss if you ask me... Gotta be a better way than that...

Indeed and Eureka! A far more elegant solution does exist. To understand what's goin' on, figure this. OSX stores the default login keyboard in the root Library Preferences, however, there are two types of Libraries: one is the mentioned root, which is also visible, and a second is the user Library, invisible ever since Mavericks, and it was created inside the user folders. After you, as a user, select several working keyboards, the list is written into your user's Library, and not in the root Library. It's in the preferences of that root Library that the US standard keyboard is glued down and won't go away. Unless... you copy your user keyboard preferences from the user into the root Library. 

To do that, simply open Terminal and copy this:

sudo cp ~/Library/Preferences/com.apple.HIToolbox.plist /Library/Preferences/ 

You do that, then enter your password, and all's said and done. Logoff and login again. At your keyboard drop-down you'll now find all the keyboards that you specified in your 'Language and Region' panes.

7 comments:

Kåre Olaussen said...

This is very useful information, but there may be one stumbling stone left:

Make sure that /Library/Preferences/HIToolbox.plist is readable by all. Like this:

bringen:/Library/Preferences$ ls -l com.apple.HIToolbox.plist
-rw-r--r-- 1 root wheel 470 Nov 6 16:13 com.apple.HIToolbox.plist

(I could not get it to work at first, because the file I copied had permissions -rw-------)

Joern L. said...

Thanks a lot. That worked perfectly for me.

Unknown said...

This worked for me too, thank you

Anonymous said...

Been looking for a solution for a while. Yours worked perfectly. Thank you!

Unknown said...

I tried pasting the above code in the main terminal window and it did not work :(
Does this process still work to this day on Catalina? Apple Customer Support was stumped and unable to help.

Unknown said...

I can echo the comment above: On Big Sur (and I suspect on Catalina), this doesn't work if FileVault is enabled. The system volume's /Library directory isn't available when the password screen is shown (as that's used to decrypt that volume).

I suspect you need to set something similar / the same thing for the preboot volume, but that requires disabling SIP. Oof.

Kova Lucas said...

If you have the following PC issues, I have the solution:

Your computer is running slower than usual
Does it take forever to run or load programs
Your computer freezes up or crashes at random
You are plagued by the Blue Screen of Death
Computer errors frequently pop up and hassle you
Your system takes forever to boot up or shut down

You don't need technical expertise to use this software. Try it for a free diagnosis so you can pinpoint exactly how to boost system performance.

www.registry-clean-up.net