2

I have a Mac and using it with an external keyboard.

I know that whenever you connect a new keyboard, OS X asks you to detect a keyboard layout by pushing a few keys, and very same thing can be done via Apple Menu > System Preferences > Keyboard > Change Keyboard Type... button.

Somehow my OS X forgets the layout settings whenever it reboots, and asks me to set the layout again. Also, I would like it to stick with one layout for whatever keyboard it gets.

Is there any simple way to achieve this? I am feeling that there should be either:

  • A console command to do the same thing that UI does, or
  • An underlying function call to either the kernel or some driver, which the Keyboard.prefPane uses.

Thank you guys in advance.

3

1 Answer 1

0

WARNING: I experienced some macOS crashes after doing what is described below. Pressing any key on the external keyboard crashed my MacBook. I recovered by (sudo) deleting /Library/Preferences/com.apple.keyboardtype.plist.

While you might need to logout/reboot for this to have any effect, you can write a value to the entry corresponding to your keyboard in /Library/Preferences/com.apple.keyboardtype.plist using defaults. I believe a value of 41 represents ISO.

sudo defaults write /Library/Preferences/com.apple.keyboardtype.plist keyboardtype -dict-add "49948-1133-0" 41

Find out which dictionary key you need to change by finding the vendor and product IDs for your keyboard:

ioreg -p IOUSB -c IOUSBDevice | grep -e class -e idVendor -e idProduct

P.S. I noticed the Change Keyboard Type button doesn't always appear. Sometimes it will after re-plugging the keyboard, sometimes it won't. And even then changing the type won't have any effect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .