You plug an Italian keyboard into a MacBook bought in the US, and half the symbols come out wrong. Switch the Mac to Italian and now the built-in keyboard is wrong instead. That’s because macOS uses one input source (Apple’s name for a keyboard layout or input method) for every keyboard at once. This guide sets up both layouts, fixes the keys macOS can fix per keyboard, and makes the layout follow the keyboard you type on.
Why one layout applies to every keyboard
The active input source is a single system-wide setting. Whatever you pick in the Input menu applies to the built-in keyboard and every USB or Bluetooth keyboard alike. macOS can switch it with a shortcut, or remember one per document, but it has no option to tie an input source to a keyboard.
Two things are remembered per keyboard: its keyboard type (ANSI, ISO or JIS, which decides what a few keys near Shift and Return type) and its modifier keys. Steps 2 and 3 cover those.
Step 1: Add a layout for each keyboard
- Open System Settings › Keyboard.
- Under Text Input, click Edit… next to Input Sources.
- Click +, pick a language, then the layout that matches the keys printed on your keyboard (Italian, German, British, French, and so on), and click Add.
- Turn on Show Input menu in menu bar, so you can see and change the active layout.
Not sure which variant matches your keycaps? Choose Show Keyboard Viewer from the Input menu and compare it with the keyboard in front of you.
Step 2: Set the keyboard type
When you connect a keyboard macOS doesn’t recognize, Keyboard Setup Assistant opens and asks you to press a couple of keys to work out its type. If you dismissed it, or it guessed wrong, you’ll notice the key left of 1 and the key left of Z swapping or typing the wrong symbols (§ and `, < and >).
To run it again, connect the keyboard, open System Settings › Keyboard and click Change Keyboard Type…. A wrong keyboard type looks like a wrong layout, but no input source will fix it.
Step 3: Swap Command and Option on Windows keyboards
On a keyboard made for Windows, the key next to the space bar is Alt, where a Mac keyboard has ⌘. To swap them for that keyboard only, open System Settings › Keyboard, click Keyboard Shortcuts…, choose Modifier Keys, select the external keyboard in the menu at the top, and set Option to Command and Command to Option.
Step 4: Switch the layout when you switch keyboards
Both layouts are installed. What’s left is choosing the right one each time you move between keyboards.
By hand
Press Control Space to go back to the previous input source, press 🌐 if Keyboard settings set it to change the input source, or pick one from the Input menu. It works, but you have to remember every time, and the first word on the other keyboard usually comes out wrong.
Per document
In the Input Sources settings from step 1, turning on Automatically switch to a document’s input source makes each window remember the last input source you used in it. That helps when each document has its own language, not when you switch keyboards inside the same document.
Automatically, per keyboard
This is what Keyameleon adds. It’s a free, open-source menu bar app for macOS 26 or later:
- Install it with Homebrew,
brew install --cask mastro993/tap/keyameleon, or download the DMG from the latest release and drag Keyameleon into Applications. - Open it. Guided setup asks for Input Monitoring, which it uses only to tell which keyboard a key press comes from.
- Pick an input source for each keyboard: for example U.S. for the built-in keyboard and Italian for the external one.
From then on, when you start typing on a keyboard, Keyameleon switches to that keyboard’s input source, in every app. Keyboards are remembered across disconnects and restarts. One caveat: Keyameleon switches after it sees a key press and never alters your input, so the first key on a newly used keyboard can still use the previous layout.
On macOS 14 or 15, look at Keychange instead; see Keyameleon vs Keychange. For a command-line option, see Keyameleon vs autokbisw.
Troubleshooting
- Only a few keys are wrong (around Shift, left of 1, near Return): the keyboard type is wrong. Redo step 2.
- Most symbols are wrong: the active input source doesn’t match the keyboard’s printed layout. Check the Input menu.
- ⌘ and Option feel swapped: set the modifier keys for that keyboard, as in step 3.
- Keyameleon doesn’t switch: open its menu bar menu. A notice explains what’s wrong, such as Input Monitoring being off, switching being paused or an assigned layout no longer installed, and offers the fix.
- No switch while typing a password: macOS hides keyboard activity from other apps while Secure Input is on, in password fields for example. Switching resumes once it’s off.