I just acquired a new keyboard, a CHERRY MX 8.2 TKL Wireless, for use with several different machines (as I use it connected to a USB switch, that is used by 4 different machines), and macOS was acting up again. The “less than” (<) and “greater than” (>) keys were at the wrong place, as was the “caret” (^) key. They had exchanged their positions, so to speak.
It turned out that this was due to the fact that the “keyboard type” was set to “ANSI,” instead of “ISO.” In theory, this should be easy to configure in macOS’ “System Settings”, however, this didn’t work for me. Many people have this issue as I found out, and sometimes there doesn’t seem to be a straight-forward solution, so I decided to wrap up these quick instructions how to force your Mac to use ISO.
The settings are contained in /Library/Preferences/com.apple.keyboardtype.plist
, and you can display them as follows:
% defaults read /Library/Preferences/com.apple.keyboardtype.plist
{
keyboardtype = {
"1031-4176-0" = 41;
"176-1130-0" = 41;
"229-1130-0" = 40;
"232-1671-0" = 41;
"2324-10429-0" = 41;
"236-1130-0" = 40;
"50475-1133-0" = 41;
};
}
This shows various keyboards that were or still are connected to my Mac, and their keyboard types. 40 is ANSI, while 41 is ISO.
Do not try to cat
the file or edit it with a text editor, as it’s a binary file that can’t be easily displayed or edited without converting it into XML format. To do so, run the following command:
% sudo plutil -convert xml1 /Library/Preferences/com.apple.keyboardtype.plist
You can then edit the file with your favourite text editor as an XML file:
% sudo vim /Library/Preferences/com.apple.keyboardtype.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keyboardtype</key>
<dict>
<key>1031-4176-0</key>
<integer>41</integer>
<key>176-1130-0</key>
<integer>41</integer>
<key>229-1130-0</key>
<integer>41</integer>
<key>232-1671-0</key>
<integer>41</integer>
<key>2324-10429-0</key>
<integer>41</integer>
<key>236-1130-0</key>
<integer>41</integer>
<key>50475-1133-0</key>
<integer>41</integer>
</dict>
</dict>
</plist>
I changed all keyboards to ISO format, and even without converting the file back to its binary format, the changes were immediately applied after saving the file, and my keyboard finally behaved properly.
For the sake of completeness, here’s how you would convert the file back to its binary format:
% sudo plutil -convert binary1 /Library/Preferences/com.apple.keyboardtype.plist
I hope this helps. Let me know your experience, please. Many thanks.