60

Hi this is a new problem that I did not have a few weeks ago.

I have a Logitech Illuminated Keyboard running on Mac OS X 10.6 (Snow Leopard).

The problem is that I cannot type a tilde. Instead when I press the tilde I get this character:

§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

I cannot for the life of me figure this out, except that I vaguely remember I can asked to redetect the Mac keyboard layout for this keyboard and I think i chose the wrong one.

Now I get this weird character when pressing tilde. How can I fix this? Or how can I redetect this keyboard layout? Thanks.

slhck
  • 223,558
  • 70
  • 607
  • 592
Brock Woolf
  • 1,886
  • 3
  • 19
  • 17
  • 1
    What keyboard (Input Source) is selected in "Language and Text" in your System Preferences? Of note the character you're printing can normally be inserted using Option-6 (the section character) – Chealion Nov 02 '09 at 01:57
  • 4
    On some Apple keyboards, a backtick/tilde key is left from "Z", on others it's left from "1" (and the other position is then "§/±"). And there's probably more options here. So: where is it on your Logitech keyboard? – Arjan Nov 03 '09 at 11:07
  • Makes me wonder: can you somehow still switch between application windows? (Command-Tab to switch between applications, Command-tilde to switch between the windows of an application)? – Arjan Nov 03 '09 at 11:24
  • Arjan: No i cannot command-tilde between windows. The character output doesnt work in any form for me. – Brock Woolf Dec 01 '09 at 16:56
  • @Chealion: Option-6 gives me: § - Nice try though – Brock Woolf Dec 01 '09 at 16:56
  • I'm experiencing something very strange with my Mac and keyboard combo. It's a Canadian-French keyboard. In OS X, the OS insists on priting § and ± instead of ` (backtick) and ~ (tilde). However, inside of my Virtualbox VMs, they act perfectly fine. Totally mysterious behaviour! I gotta swap keyboards, soon! XD Oh, and, I've tried a variety of US and Canadian "language/keyboard" settings. Haven't been able to get the US mapping to work on this keyboard at all, except inside of VMs for some reason! – starlocke Aug 12 '13 at 20:54

17 Answers17

29

On a keyboard with that "<>|" button between the left shift and Z, holding down Shift and pressing that button works on my end. Neither Alt-5 nor Alt-N do the trick on my end.

Teekin
  • 466
  • 1
  • 4
  • 4
27

If someone else is still interested in how to swap the § key with ~, I use Karabiner to do that and it's pretty easy to use. Just look for that option which is included in the default ones among others.

enter image description here

It can also be used to remap other keys if you want. For example, you can use hjkl keys to emulate the arrow keys (vim users will love it).

goerwin
  • 371
  • 3
  • 5
  • +1 This solution worked straight away for me, it is the simplest solution ever, thanks!. On the other hand, using Ukelele didn't work for me, the keyboard layout bundle is not recognized. – Clint Eastwood Jul 28 '15 at 15:05
  • 2
    ...so 6 years later Karabiner-Elements is significantly different; how do I do this now? – Jason S Dec 05 '20 at 16:21
  • 6
    @JasonS, apply this Simple Modification swapping "non_us_backslash" and "grave_accent_and_tilde" keys: [screenshot](https://i.imgur.com/oOkm0tp.png) – arteg Dec 10 '20 at 16:40
  • 1
    Don't forget to go to "Devices" menu and activate the "Modify events" toggle for your keyboard, it wasn't on by default for me despite the key modifications – Alessandro Jun 21 '23 at 08:05
25

The correct way to fix your problem is to get your Mac to re-detect your keyboard type.

Open your Keyboard preferences (System preferences → Keyboard) and on the bottom left side you will see a "Change Keyboard Type" button.

Keyboard - System preferences

Click on it and follow the instructions.

Federico JM
  • 359
  • 3
  • 4
15

Don't know if you are still reading this but if you download a program called Ukelele, you can make custom keyboard maps.

Then you need to put the keyboard map into ~/Library/Keyboard Layouts/, log off and then back in.

Once you have done this you can choose your custom keyboard layout and you will be able to use the ~ key without any problem (I'm using a Logitech illuminated keyboard using the default Logitech-UK keymap that comes with Ukelele and everything works).

M K
  • 2,744
  • 2
  • 15
  • 20
11

With Karabiner-Elements, it can be done by swapping non_us_backslash and grave_accent_and_tilde keys like so:

Karabiner-Elements Simple Modifications screenshot

I needed this setup for my German keyboard which use with both English and German layout.

AndiDog
  • 636
  • 3
  • 10
  • 15
  • This worked for me - I would never have stumbled upon non_us_backslash - the other option key solutions won't work for me as I use both '`' and '~' all the time. – bloke_zero Jul 20 '18 at 08:47
  • Funny since Karabiner Elements was the application for me that screwed it up. I had to quit Karabiner Elements to get the keyboard to work normally again. I have not changed this setting from karabiner elements. Of course I could do this and have both working, but I feel that Karabiner should not change this in the first place – Shuyinsama Jul 13 '20 at 05:43
9

Usually ~ character is associated with "n" letter. So you can do ~ using "Option + n" keys.

When you do not know how to type a char, you should try the keyboard viewer in the last tab of the "langage and text" icon of the prefs panel.

Luka
  • 264
  • 1
  • 5
  • Protest ;-) There's no "Alt" in OS X. See http://superuser.com/questions/25005/forward-delete-using-apple-keyboard/25022#25022 ;-) (Option-N followed by n or N can be used to get ñ and Ñ. But indeed, Option-N followed by space yields just `~`. Still, Brock's keyboard layout does not match the actual keyboard.) – Arjan Nov 03 '09 at 11:04
  • Sorry, on french layout the "option" is also co-named "alt" – Luka Nov 03 '09 at 11:12
  • I edited the answer to take your comment into account. Thanks ! – Luka Nov 03 '09 at 11:15
  • *on french layout the "option" is also co-named "alt"* -- yes, on my Macs as well, but that's not *used* in OS X. Of course, it's not a real issue (let's get world peace first). See that link I gave for some thoughts on "Backspace" and "Alt". I actually hope that French keyboards have a tilde key as well? I can't live without it, like using Command-~ to switch between application windows. – Arjan Nov 03 '09 at 11:20
  • Yes, the alt thing is "Linux and Windows" related, your link is very well documented and interesting. Thanks for the reminder ^^. By the way, the French layout and the Apple-French layout are completely different. The ~ is not on the Apple-French : you need "Option + n" – Luka Nov 03 '09 at 11:24
  • Then how does one switch between application windows on a French keyboard? On other Apple keyboards, one would press Command-tilde. I hope this does not translate to Command-Option-N-space on a French keyboard? – Arjan Nov 03 '09 at 12:14
  • 4
    On my layout option + n produces a ˜, which is different to the tilde, which is ~ – Josh Hunt Nov 03 '09 at 12:23
  • @joshhunt, Your ˜ is http://www.fileformat.info/info/unicode/char/02dc/ which on my US keyboard is Shift-Option-N. Using that US layout, Option-N (without holding Shift) does not give me any character yet, but it shows a yellow ~ to indicate I can compose another character with it. Next, pressing N, n, A, a, O, o or space, yield Ñ, ñ, Ã, ã, Õ, õ or ~. (Also, keyboard viewer shows the changed characters after pressing Option-N. Holding down Shift with US Extended changes the character before the cursor, to even create q̃w̃ẽr̃t̃ỹ...̃) I guess things can be very different on some keyboards. – Arjan Nov 04 '09 at 12:41
  • Try using the keyboard viewer when you want to type commands that use the ~ in the path day in day out - Not an ideal solution. – Brock Woolf Dec 01 '09 at 16:54
5

On a Mac, tilde can be obtained using the key combination Alt+5.

Let me stress that Alt+5 returns tilde ~, whereas Alt+n returns tilde as character apice ˜.

Journeyman Geek
  • 127,463
  • 52
  • 260
  • 430
dario
  • 59
  • 1
  • 1
5

What characters you get by typing with key, , or combination of the two (there's also , remember) depends on which language keyboard you use.

To find out all characters on your keyboard enable Keyboard & Character Viewer in Input Sources inside Language & Text.

With U.S. keyboard type ` (near the left Shift button).

slhck
  • 223,558
  • 70
  • 607
  • 592
Mantvis
  • 51
  • 1
  • 2
2

The best and easiest way is:

  1. Shift+` Obs.: Between left Shift and z

  2. Then s p a c e

show on keyboard

Io-oI
  • 7,588
  • 3
  • 12
  • 41
wakedeer
  • 121
  • 2
2

On my macbook air with Danish keyboard layout, ~ key combination is alt + ^.

BlueBerry - Vignesh4303
  • 8,129
  • 22
  • 68
  • 99
Leo
  • 21
  • 1
2

In my case, on OSX 10.9.1 ~ on my German Airbook using US American layout is mapped to Shift and the key directly to its right.

k0pernikus
  • 1,970
  • 8
  • 28
  • 40
0

You can remap using this file

~/Library/LaunchAgents/com.example.KeyRemapping.plist

https://chuyeow.wtf/2020/06/24/remapping-keys-on-macos

https://gist.github.com/chuyeow/2ab2d3e6a649389cea58f4d31f7f6d53

You can use this tool to generate the configuration:

https://hidutil-generator.netlify.app/

You just need these two lines in the "UserKeyMapping" section

       {
         "HIDKeyboardModifierMappingSrc": 0x700000064,
         "HIDKeyboardModifierMappingDst": 0x700000035
       }

This will map the "Keyboard Non-US " to be " Keyboard Grave Accent and Tilde "

Mostafa
  • 11
  • 4
0

For me the answer was to do the System preferences -> Keyboard -> "Change Keyboard Type" operation in the answer https://superuser.com/a/1277702/501186 - BUT, instead of using the ISO option it suggested, I needed to choose the ANSI option.

Even though I'm in the UK, all my keycaps now reflect the right values.

I'm using a Logitech K860. This never used to be a problem, until my keyboard started randomly disconnecting and I performed a reset on it.

Moby Duck
  • 151
  • 1
  • 3
0

I encountered a similar problem where I have a German keyboard with an english keyboard layout and the window switcher in Mac OS X was supposed to be activated by pressing Cmd+~. However, when I pressed it, it didn't work as expected. While some previous answers in here work, they don't apply to Mac OS X 13.1 Ventura since the system preferences menu has changed. I was able to fix the problem by going to System Preferences -> Keyboard -> Keyboard shortcuts -> Keyboard and then reset the Move focus to status menustoCmd+

enter image description here

Flov
  • 1,031
  • 7
  • 5
0

In my MacBook'07 keyboard I get the ~ by combining "Shift" + "`" (the next key to the right).

0

I set up KeyRemap4MacBook application and type ~ with shift+escape

setting tilde key to shift escape in KeyRemap4MacBook

Maxim Yefremov
  • 1,245
  • 5
  • 16
  • 21
0

And for those amoung us using a mac keyboard with Spanish keyboard layout, ~ key combination is alt + ñ (the Spanish ñ, instead of n).