31

This is the normal UK PC Keyboard Layout:

enter image description here

We can see the backslash is on the left-bottom corner (right of shift).

But the mac configuration for UK PC layout, the backslash is on the left-top corner (left of the number 1), see the setting as follow:

enter image description here

So when I use both mac and windows together, this key always confuse me with different output!

UK layout keyboard is ISO standard and the Mac also detects ISO. The only issue is the key on the left of z is switched with the key on the left of 1.

The layout of the UK keyboard:

  1. the key on the left of z should be:\ and |
  2. the key on the left of 1 should be: ` and ¬

But mac switches them.

6
  • Hello Xin, welcome to Ask Different. Yes, the Mac "British - PC" and UK PC keyboard layouts are indeed different, it is described in Wikipedia: en.wikipedia.org/wiki/…, but we can only guess "why" that's the case (only Apple has the answer). I'd recommend that you rewrite your question, otherwise it will probably be flagged as "primarily opinion-based" and eventually be closed.
    – jaume
    Sep 2, 2018 at 11:09
  • What keyboard do you actually have connected? - that makes a difference. Is it an Apple kbd, or a 'windows' one.
    – Tetsujin
    Sep 2, 2018 at 11:23
  • 1
    @jaume ok got it. So I will modify the question to how to switch these two keys on Mac to make it same with normal UK PC layout.
    – Xin Meng
    Sep 2, 2018 at 11:24
  • I use Ukelele to make custom keyboard layouts. Sep 2, 2018 at 11:48
  • After further experimenting, we need to know not only exactly what keyboard you have connected, but also what OS you're using [& precisely what Mac would be useful additional info]
    – Tetsujin
    Sep 2, 2018 at 12:01

9 Answers 9

9

It appears to be controlled by what you actually have connected... but there is something else going on I'm still trying to hone down.
The best conclusion I can come to at the moment is "it's a bug" but one that seems to be at least partially fixed in High Sierra & Mojave.

This is a UK Apple Keyboard on Mojave [confirmed identical on High Sierrs]

When you first open the panel, it shows as ANSI.

enter image description here

Press Shift [which I discovered by accident trying to take screenshots] & it changes to ISO.

enter image description here

Then add British PC & it seems to retain that information...

enter image description here

Now I've persuaded it to show like that I can't 'break' it again, it seems to stick so far.


However, testing on El Capitan, I can't persuade it to flip to ISO, no matter what I do - it stays as ANSI...

enter image description here

Test on the El Cap machine, swapping a TextEdit document from British to British PC - even though the control panel still claims it's ANSI & after clearing all keyboard prefs & re-detecting the keyboard...

enter image description here

The Mac 'knows' it's ISO, but won't display as that in the Keyboard Input Sources control panel.

16
  • You have a keyboard with the extra key next to z that El Capitan will not recognize as ISO, even when you use the various remedies in m10lmac.blogspot.com/2009/12/fixing-keyboard-type-problems.html ? Sep 2, 2018 at 12:14
  • Only a tiny number of users have problems with ISO keyboards, so I don't see how this would be a "bug". Sep 2, 2018 at 12:21
  • I've tried 2 different kbds on the El Cap Mac - which is a 10-year-old Mac Pro 3,1. This issue has been there since new & doesn't affect how the connected keyboard actually types, just how it appears in that CP. I've tested it today with its current Logitech UK PC keyboard & also its original Apple wired UK extended. I've tried trashing the kbd plist & regenerating from the setup assistant. No change. In all other respects the machine appears to behave as it ought. Same issue occurs on both High Sierra or Mojave, until you tap the Shift key. I still say 'bug'. Answer edited.
    – Tetsujin
    Sep 2, 2018 at 12:42
  • @Tetsujin my mac version macOS High Sierra version 10.13.4. what's your mac version? I think you got a right British PC layout with backslash next to Z. But I still cannot find it
    – Xin Meng
    Sep 2, 2018 at 13:01
  • @Tetsujin Thanks for clarifying that you do not have a typing problem, just a problem with the display in the preference pane. But Xin Meng has a typing problem, which is a different animal I think. Sep 2, 2018 at 13:04
9

You need to run the Keyboard Setup Assistant again, and the only reliable way to do that is to delete the files it generated as follows (run this in the terminal):

sudo rm /Library/Preferences/com.apple.keyboard.plist
rm ~/Library/Preferences/com.apple.keyboard.plist

Then restart your computer. When you log in / plug in the keyboard it should show you the Keyboard Setup Assistant and ask you to press the key to the right of the left shift, i.e. the \ key on a normal UK keyboard. Do as it asks, and it should detect your keyboard as ISO (not ANSI). Accept that, and then make sure in System Preferences -> Keyboard -> Input Sources you are using the British - PC layout.

keyboard

That should give you a normal keyboard layout, with one exception - the Ctrl key (the bottom left one) will be mapped to the Mac Control key, which you rarely use, and the Windows key will be mapped to Command. You probably want to swap those so that copy/paste shortcuts etc. are the same as on Windows.

The easiest way to do that is to install Karabiner-Elements and set it up like this:

karabiner

Also note that this keyboard layout is not applied before you log in after a reboot, but it is applied before you log in after logging out. Very confusing if you have " or @ in your password!

Edit: I have found an easier way to re-run the keyboard detection wizard rather than restarting - change the Country Code in Karabiner-Elements as follows:

country code

You just need to increment it. The actual value doesn't matter.

5
  • This was the answer that worked for me - I suspect I had originally chosen ansi.
    – Joe
    Jan 22, 2021 at 12:55
  • @Timmmm is it possible to run the keyboard detection again in MacOS 12.0.1? Neither of those files exist for me.
    – mjaggard
    Nov 22, 2021 at 17:47
  • Yes, I've had continual troubles with this on Mac. It seems to be very buggy. The point I've ended up at is: 1. Keep the British and British - PC layouts and show the layout in the menu bar. If it stops working the first thing to try is just switch between them. And then if that fails I go to the Virtual Keyboard tab in Karabiner preferences and increment the Country Code. That should trigger the keyboard detection dialog. I'm up to 2 at the moment.
    – Timmmm
    Nov 23, 2021 at 10:41
  • 2
    I removed /Library/Preferences/com.apple.keyboardtype.plist and rebooted my computer. That made Mac OS show the ISO layout (easily visible by the large Enter key) in the overview and then British-PC showed the correct layout too. Apr 19, 2022 at 8:26
  • It was only after removing the file in @00schneider's answer and rebooting did i get the dialog to detect my keyboard and it suggesting iso. Once I then selected british-pc input it all worked.
    – dwxw
    Jan 5 at 21:20
4

You seem to have a US (ANSI) keyboard, where there is no letter key to the left of the Z. Is that correct? For a "normal" UK layout, you must have a European (ISO) keyboard which has this extra key.

If you do have an ISO keyboard with extra key, then you have a keyboard type problem.

4
  • 1
    Nope, I have the ISO keyboard definitely. Because UK layout keyboard is ISO standard and the Mac also detects ISO. The only issue is the key on the left of z is switched with the key on the left of 1. The layout of the UK keyboard : 1. the key on the left of z should be:` and |` 2. the key on the left of 1 should be: ``` and ¬ But mac is switched them.
    – Xin Meng
    Sep 2, 2018 at 10:07
  • @TomGewecke - I think we found a bug with a partial workaround. See my answer; though I'm still experimenting...
    – Tetsujin
    Sep 2, 2018 at 11:47
  • @xin meng Your settings screenshot is clearly NOT ISO, but ANSI. So your machine is NOT recognizing the keyboard type correctlly, if your keyboard in fact has the extra key. Sep 2, 2018 at 12:16
  • Thanks, this helped me a lot. I have a QMK keyboard connected to my Mac, without correct setup, every time I type the ` (grave) key, it outputs the § (section) key. After setting it to ANSI type, I can finally type ` and ~ correctly.
    – maximus
    Jun 3, 2022 at 3:31
4

In the end, installing the Karabiner app fixed the issue.

1
  • Same here. I could get as far as just one key not working, the backslash, however Karabiner fixed this issue.
    – Ben
    Apr 22, 2020 at 9:49
4

Make sure you have configured the Keyboard settings under Keyboard > Change Keyboard Type... first.

Once you have configured the Mac in ISO mode the right settings should be applied, you may need to remove and add the input device (British -PC) afterwards.

4
  • 3
    What should one do if "change keyboard type" isn't there? Sep 12, 2019 at 13:17
  • This worked for me.
    – fepegar
    Dec 28, 2020 at 11:57
  • @evolutionxbox The button is on the "keyboard" tab, all the screenshots in the question are of the "input sources" tab. Nov 18, 2021 at 14:00
  • I'm facing this issue again and, as @evolutionxbox, can't find that button under the Keyboard tab.
    – fepegar
    May 15, 2022 at 15:20
3

The following Karabiner config works for me:

config

1

I uninstalled Karibiner for some other reason and then remembered why I had installed it in the first place - for this issue.

However I removed the preferences files as shown above and rebooted (which may have nothing to do with the solution) and then went into the keyboard setup assistant and on to identify my keyboard.

When it asked me to press the key to the right of my left shift key I actually pressed the key to the left of the '1' key instead, and it it now generates the expected keys correctly. Haven't spotted any issues so far.

1

This is what worked for me with my Cherry KC1000 on Catalina: While connecting the keyboard, when asked about the key next to the left shift, skip the backslash key and press "Z" as if it was a regular US keyboard. On the next screen select international US ASCII keyboard. Now the British-PC layout will work as expected, along with backslash and backtick keys.

0

I also experienced this issue and didn't have much luck with the approach suggested by Tetsujin. I did find however that by going into 'Keyboard -> Input Sources' and removing British - PC and re-adding it and it appeared to pick up the keyboard layout successfully. This was on Monterrey 12.6.2

You must log in to answer this question.

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