Skip to content

Instantly share code, notes, and snippets.

@ainsleyrutterford
Last active March 28, 2024 12:58
Show Gist options
  • Save ainsleyrutterford/1860376d26256e28f310b86265b1aa51 to your computer and use it in GitHub Desktop.
Save ainsleyrutterford/1860376d26256e28f310b86265b1aa51 to your computer and use it in GitHub Desktop.
Fixing tilde key for European ISO keyboards in macOS

When plugging in the bear_face keyboard (by chemicalwill) to a new laptop, I found that it was not letting me select "ISO (Europe, Latin America, Middle East and others)" in the Keyboard Setup Assistant (which was the value on my old laptop), it was only letting me choose "ISO (International)".

As a result, the tilde (~) and plus equals (±) keys were swapped. I couldn't get any other solutions to work for me, and didn't want to manually remap, so I decided to just try and replicate the settings on my old laptop. You can edit the plist file directly like so:

cd /Library/Preferences
sudo chmod a+w com.apple.keyboardtype.plist
sudo plutil -convert xml1 com.apple.keyboardtype.plist
vim com.apple.keyboardtype.plist
sudo plutil -convert bindary1 com.apple.keyboardtype.plist

I just edited the plist to be exactly what my old laptop's settings were since I was lazy:

<?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>1047-6473-0</key>
		<integer>43</integer>
		<key>123-5426-0</key>
		<integer>40</integer>
		<key>126-5426-0</key>
		<integer>40</integer>
		<key>165-5426-0</key>
		<integer>43</integer>
		<key>166-5426-0</key>
		<integer>43</integer>
		<key>2040-1118-0</key>
		<integer>41</integer>
		<key>2549-65261-0</key>
		<integer>43</integer>
		<key>402-1241-0</key>
		<integer>41</integer>
		<key>49948-1133-0</key>
		<integer>40</integer>
		<key>49995-1133-0</key>
		<integer>40</integer>
	</dict>
</dict>
</plist>

Then restart, and the changes should be applied.

You can also edit an individial key like so:

sudo defaults write /Library/Preferences/com.apple.keyboardtype "keyboardtype" -dict "2549-65261-0" -integer 43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment