106

I want to type unicode characters with the keyboard. I'm looking for a solution with no mouse usage. For example, below I have a line with the unicode "PILE-OF-POO" character:

💩

The codepoint for PILE OF POO is U+1F4A9 and on a linux operating system I can create this character by typing:

Ctrl+Shift+u,

1, f, 4, a, 9

space

How can I do something similar on a mac keyboard? Other answers I've searched involve fiddling with menus and switching input sources.

4 Answers 4

109

Press Ctrl+Cmd+Space to bring up the characters popover.

Open character popover

Then type in part of the character's natural-language name (eg "arrow), or the exact Unicode code point (below) and press the down arrow to select the symbol.

Type in code point

Then simply press Enter to insert the character at the location of your previous cursor.

Additional information:

Note the icon in the top right of the character popover. It changes the popover to the full Character Viewer, which cannot be navigated by the keyboard. Click the icon in the top right of the Character Viewer to return to the popover. Many thanks to @Tom Gewecke for this information.

11
  • 2
    I don't think this will work if you normally have the expanded version of the Character Viewer active. You have to use the mouse to get back to the small one you are showing. Or is there a keyboard shortcut to do that? Jul 27, 2017 at 10:26
  • That's right, this only works with the popover variant not the bigger window.
    – malte
    Jul 28, 2017 at 9:40
  • 3
    How do you get the popover variant? Is there something similar on IOS? Having frequently used right at the top is great.
    – WGroleau
    Jul 29, 2017 at 15:47
  • 4
    @WGroleau To get the popover, you click on the small icon in the top right corner of the expanded version. For iOS I think you could use an app like Unicode Pad itunes.apple.com/us/app/unicode-pad/id374098312?mt=8 Jul 29, 2017 at 16:04
  • 1
    I had to use the mouse to get the cursor inside the search box of the popover. Keyboard focus was still in the application and not in the popover. I have a bunch of keyboard mods, like SizeUp and Karabiner, going, so I am not sure about the default behavior.
    – Reb.Cabin
    Sep 6, 2017 at 12:20
58
+50

U+1F4A9 converts to d83d dca9 in unicode hex input, which is what OS X uses as an official input source across the OS.

To use the keyboard directly with their code numbers, first enable Unicode Hex Input in System Preferences -> Keyboard -> Input Sources. Then, each time you wish to use that input method, switch to the Unicode Hex layout (this can be done via a keyboard shortcut that by default conflicts with spotlight) and then hold the option/alt modifier while you type the the utf-16 hex codes you wish (which is really two hex codes for characters beyond the Unicode BMP, such as 1f4a9, which is represented by d83d dca9).

option held down then d, 8, 3, d, d, c, a, 9

A which point, you will have summoned 💩

Not much fun to type.

If you have a finite number of such characters you want to make, you can set up keyboard shortcuts for them in system prefs/keyboard/text in the substitutions table.

11
  • 1
    substitutions could be an acceptable workaround. I tried setting up a substitution for pileofpoo -> 💩 , but it isn't doing anything. Could you add more details of how/where this is supposed to work?
    – wim
    Apr 29, 2015 at 5:33
  • 2
    No, trying in text boxes in the browser, in jetbrains IDE , in the built-in terminal app, sublime text ... not working in any of those
    – wim
    Apr 29, 2015 at 22:30
  • Can you input that character using the Character Viewer in those apps? Apr 29, 2015 at 23:16
  • 3
    If you don't enable unicode hex input, you get ∂•£∂∂çåª output. @bmike your edits are confusing the post a bit and should be reordered.
    – wim
    Sep 23, 2015 at 12:08
  • 2
    For those not familiar with using the surrogate characters (UTF-16), the conversion is like this: 1f4a9 -> f4a9 -> 03d,0a9 -> d800+03d,dc00+0a9 -> d83d,dca9 Subtract 0x10000, High/Low ten bits, Add Hi/Lo surrogate bases
    – dmaestro12
    Sep 29, 2016 at 13:53
20

In System Preference, select "Keyboard", then select "Input Sources". The left hand pane will show your preferred language keyboard, and possibly alternates. If Unicode Hex Input is not there, click the + button beneath; you will get a long list of languages. Scroll to the very bottom and choose others. Unicode Hex Input will appear in the right pane, then click the Add button, bottom right.

Tab over to Shortcuts and choose the shortcut key. AltSpace and CmdSpace may already be taken by Spotlight. Either disable them, or reassign by clicking at the right-hand end of the column and typing your new key. I left them as they were and assigned CtrlSpace for Input sources.

If you do that, now when you type CtrlSpace, you will see the little flag, top right of the menu bar change to a U+. You can then enter your hex codes (which you can find out from the Emoji & Character Viewer) by holding Alt while you type the numbers. E.g. for U+2282 SUPERSET OF taken from any lookup source, Alt2282 produced the Set member symbol ⊂.

6
  • When adding the input source, after pressing the + at the bottom of the screen instead of scrolling to the bottom you can enter "unicode" in the search field and it should show you the Unicode Hex Input as a result. Confirmed to work on macOS 10.12
    – ekscrypto
    Apr 17, 2017 at 15:29
  • At least on Mac OS 10.11 there's an option in System Preferences to show input sources in the menubar, so it's easy to switch (of course using your mouse).
    – z80crew
    Sep 1, 2017 at 9:46
  • 1
    I got this all turned on. Now when I type option d83ddca9 I see nothing until I type one more character, such as 0, 1, ..., e. Option d83ddca90 yields 쪐, option d83ddca91 yields 쪑, ... option d83ddca9e yields 쪞. With all that Hangul, there must be a pile-of-poo somewhere.
    – Reb.Cabin
    Sep 6, 2017 at 12:34
  • @Reb.Cabin Do you have that problem here? I don't 💩 Sep 6, 2017 at 18:21
  • @TomGewecke must have been a glitch my side. it's working for me now.
    – Reb.Cabin
    Sep 21, 2017 at 15:24
2

Another solution would be creating a custom keyboard layout which will include the characters you want.

Most of the characters mapped to Option (⌥) + letters (e.g. Ω≈ç√∫˜µ≤≥˚∆˙ƒ∂ßåœ∑...) are probably never used by anyone so those can be remapped to output your own symbols/emojis.

A mac keyboard layout can be an XML or a .bundle file and you can use the free app Ukelele to clone an existing layout, modify the mappings as you need, and then export and install the new layout. The app is only used the create the layout so it does not need to be loaded in the system memory like some shortcut mapping apps do.

Also see https://superuser.com/questions/665494/how-to-make-a-custom-keyboard-layout-in-os-x

You must log in to answer this question.

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