36

Since I upgraded my MacBook Pro to macOS Sierra, two keys seems to have been switched around in the keyboard when I use my external keyboard.

I use the Spanish ISO layout, and the "º" and "<" keys have been swapped. The laptop's keyboard works fine. I have not fiddled with the keyboard configuration, other than changing to my regional layout and swapping modifier keys (it's a windows keyboard).

It worked flawlessly1 before the upgrade. I know very little of how to troubleshoot macOS, what should I do?

1 I just remembered that, no, it wasn't all that flawless; from time to time the keyboard would stop responding, and I'd have to unplug and plug again. Don't think it's related, but...

PD: It happens with all external Keyboards. Tried with a few. All of them where ISO, and it seems the problem is in macOS treating my ISO keyboards as ANSI; the laptop's internal keyboard is ISO though, and has no issue. I've done a clean install of Sierra, and it's still wrong.

8
  • 1
    I sounds like your machine thinks the keyboard is ANSI instead of ISO. ANSI keyboards have no key to the left of Z, so < is put at the top left most key. You may need to use Karabiner to fix this. Commented Sep 29, 2016 at 13:09
  • 1
    Please specify within your OQ how you swapped your external keyboard modifier keys. I bet the method used may not interoperate friendly with a hidden change in MacOS way to manage keys mapping.
    – athena
    Commented Oct 4, 2016 at 6:55
  • Have a similar issue with an external USB keyboard in PC-International Layout on macOS Sierra Version is 10.12.1 Beta. I and G keys are switched, A is not working regardless of selected layout or ANSI/ISO.
    – mxfh
    Commented Oct 4, 2016 at 13:31
  • Are you running beta software like mxfh? Commented Oct 4, 2016 at 14:52
  • 1
    I've been searching high and low for this question/answer. Had issues with < and § being switched on my Swedish keyboard. Commented Jan 3, 2018 at 9:47

9 Answers 9

44

I had the same problem with my keyboard and a German layout. Although I had "German" set up as "System Preferences/Keyboard/Input Source" most of my keys had the wrong mapping. E.g. the key right to the Left Shift Key on my keyboard is "<>" instead it was mapped to "^°".

The problem was that my keyboard was setup as an ANSI-type of keyboard (used in the US). Instead it should have been set up as a ISO-type (used in most european countries).

There are several possible solutions to this mapping problem as described by Tom Gewecke on his Blog.

The fix for this is to run the Keyboard Setup Assistant again. Sometimes there is a button for "Change Keyboard Type" visible in "System Preferences/Keyboard".

If not, you can try trashing the file /Library/Preferences/com.apple.keyboardtype.plist and restarting your machine.

Another possibility may be to open Terminal and type: sudo open /System/Library/CoreServices/KeyboardSetupAssistant.app/Contents/MacOS/KeyboardSetupAssistant

When the Keyboard Setup Assistant appears again after reboot be sure to choose the right type of keyboard - ISO.

If none of that helps follow the above link to Toms post with further options.

8
  • The only problem is these remedies would normally change the internal keyboard's mapping as well, which "works fine". So you probably need Karabiner which can change the external without messing up the internal. Commented Oct 23, 2016 at 16:07
  • Maybe I don't understand the issue here. When I updated to macosx10.12. the Keyboard Setup Assistant run once. It asked me to press the key next to the left shift key and then it asked whether I had a ANSI or ISO type of keyboard. I don't remember my choice then, but it did set up my keyboard as ANSI where it actually is a ISO keyboard.
    – aga
    Commented Oct 24, 2016 at 8:46
  • I assume your experience involved just one keyboard, right? The OP has the very strange problem that two keyboards, internal and external, are seen by the OS as being of different types. Normally that's not possible, whatever type is set for the OS applies to all keyboards. Commented Oct 24, 2016 at 15:43
  • I think I have the same problem with my Italian external (Apple) keyboard: since I installed Sierra, two keys are swapped ("<" and "\"). Could not fix the problem with any of the above suggestions. Also note that Karabiner does not yet support Sierra. I tried with the new Karabiner-Elements, where the "Devices" tab also allows setting the keyboard type - I tried setting my external keyboard as "ISO", but that didn't solve anything
    – Maiaux
    Commented Nov 2, 2016 at 10:51
  • This works, but when you re-connect keyboard again, you need to re-run Keyboard Setup Assistant again, and select ISO every time.
    – Xotabu4
    Commented Nov 14, 2019 at 12:37
8

In my case the issue seems to have been caused by a utility called Karabiner Elements.

It helps me use the Caps Lock key as an additional Escape key. After uninstalling it I removed /Library/Preferences/com.apple.keyboardtype.plist and restarted the machine. After restart the Keyboard Assistant was able to correctly identify the keyboard.

2
  • +1 -- trashing the plist file, restarting my Mac and re-identifying the keyboard worked in my case. Commented Sep 3, 2022 at 10:27
  • As mentioned in another answer, also try going into Karabiner-Elements > Virtual Keyboard > Keyboard Type. Commented Oct 21 at 20:50
7

I've had to install Karabiner Elements and then change the Keyboard Type (available on the tab Virtual Keyboard) to ISO.

Update (July 2018): After installing a MacOS update (10.13.6) the problem has appeared again. However the latest version of Karabiner Elements (12.1.0) doesn't have the Keyboard Type option anymore. There is a Country Code which was set to '1' when I opened Karabiner. After messing around with this value with no success for a while, I've restarted the Mac, which has fixed the issue.

1
  • It was this, however the keyboard still is has different keys than those proposed by apple, but at least now it is identified as ISO and not ANSI
    – htafoya
    Commented Oct 13, 2022 at 23:21
3

I've been plagued by this for a while, with \ and ` getting switched on a regular basis. macOS starts thinking my keyboard is ANSI rather than ISO, and it isn't possible to change it without restarting. That is no good when in the middle of writing a complex regex.

A workaround I have found is to use Ukelele to create a bundle of 2 keyboard layouts one that has the same mapping as printed on the physical keys, and one with the \ and ` switched.

Once installed, I can then switch between the keyboard layouts without having to reboot, and can stop fighting with macOS to recognise my ISO keyboard!

1

Had a similar issue as described above, resetting the modifier keys helped miraculously. I had switched the Ctrl/Options keys before upgrading to macOS Sierra 10.12.1 Beta.

System Preferences > Keyboard > Modifier Keys... > Restore Defaults

1
  • My Microsoft Sculpt keyboard had a non-functional 'a' key with the betas. Restore Defaults magically fixed it, thanks! Commented Oct 12, 2016 at 8:34
1

Using a nordic layout (Icelandic), it seems that High Sierra identifies nordic ISO keyboards incorrectly. On my old Logitech Cordless Pro, the right windows key is incorrectly mapped to AltGr (Right alt), and on my new Microsoft Sculpt keyboard, there is no key mapped to the AltGr key.

1

Trashing /Library/Preferences/com.apple.keyboardtype.plist, restarting the machine and giving the "proper / expected input" instead of the right input of the shift solved my problem. Thanks @aga

0

In SystemPreferences->Keyboard->InputSources click the + sign left below, go to Spanish/Español and select it: on the right check if you have selected the correct one (Spanish or Spanish-ISO).

1
  • 2
    Done, and it is the correct one. I've tried also removing it and adding it again.
    – Jk041
    Commented Sep 29, 2016 at 15:05
0

I had same issue. I've had Logitech M705 and it comes with unifying receiver. Then connected another USB wired keyboard and this layout issue occured. MacOS detect Logitech Receiver both keyboard and mouse. When I started keyboard configuration it asks for Logitech Keyboard layout until removing the unifying receiver. If there's no unifying receiver configuration tool ask for USB keyboard layout and detects neighbour-to-left-shift correctly. I resolved it that way.

You must log in to answer this question.

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