Revisiting this four years later, now with macOS Sierra.
If you have a non-Apple keyboard then you may want to use a more appropriate keyboard mapping. You can select keyboard mappings through the keyboard tab of the System Preferences dialog. Select Input Sources and use the
+ button to select a mapping appropriate for your keyboard. (You may also need to use the
- button to delete the mapping that you do not wish to use before your chosen mapping becomes fully effective.)
If you find the mappings provided by Apple to be unsatisfactory (Apple's British - PC keyboard does not map the pipe to the correct key - adjacent to the left-hand shift key) then you may install third-party layouts or create your own.
Here is a ZIP file containing two alternative layouts files for UK 105 key keyboards. You should unzip the files into
/Library/Keyboard Layouts (use
The new layouts won't be available in the abovementioned Input Sources until you log out and back in. After that, you can select them like any other layout (they may be listed in the others category).
You can edit your chosen layout if it is still unsatisfactory (I chose the British (PC 105 alt) layout but found that
Alt+3 emitted cent (¢) instead of the expected Euro (€) symbol). Layout files are simple XML text files. I identified the relevant key code and replaced its unicode
<key code="21" output="¢" />
<key code="21" output="€" />
(The change was applied in two places: keymap index 3, for anyOption key (
Alt to PC keyboard users), and keymap index 5 for the same with CapsLock on.)
(Once again, a log out/in cycle is required for the change to take effect).
The key code for the
4 key (which, when used with
Alt should produce
€) is 21. Should you wish to discover the key code for a physical key then you could use the Key Codes app, available free of charge from the Apple App Store.
Should you desire a more GUI way of customising your keyboard then you could look at Ukelele [sic] or Karabiner, formerly known as KeyRemap4MacBook (although the website states that Karabiner doesn't currently work on macOS Sierra at the moment.)
Still unresolved I wanted to identify keycodes without installing anything (think X-Windows
xev) and I could not find Apple's standard key layouts (they aren't in
/Library/Keyboard Layouts). I guess they are in
/System/Library/Keyboard Layouts in a different format. It would be nice to be able to use a standard layout as a starting point for custom edits made as described above.
An alternative is to use a text replacement or text expander. I’m guessing you used a “Keyboard Shortcut” to assign OptionN as the tilde.
However, this statement is key to the problem you’re experiencing:
The built in text replacement only works with Cocoa based apps. For instance, it works in Pages, but not in Microsoft Word. The way around it is to use a 3rd party text expander.
TextExpander is the market leader and works really well, but it’s very expensive at $40USD /year subscription.
aText isn’t as fancy but works exceptionally well (I personally use this) and is priced at only $5USD; one time purchase.
The way they work is you can type a shortcut and it will replace it with the text you’ve defined for that shortcut. For example you can create a shortcut called “tildesymbol” (too long for practical use, but it’s just an example and it will replace it with “~”. I use it for my email addresses. I assigned @1 to my primary address, @2 to my personal I only give to family and close friends and @3 is my “spam” address that I use when having to “register” for accounts.
This is completely different than switching inputs, but it may give you an alternate way of getting the symbols you need without having to remap keys or remember unicode shortcuts.