Hanyu pinyin input on macOS

I discovered a quick way to key in Hànyǔ pīnyīn tones on a Mac. If you are in the same situation and you’re on macOS, there is an easy way to add the tone marks.

Emoji & Symbols panel

Hanyu pinyin uses diacritic to mark the four tones of Mandarin. I used to do this by using control + command + space (⌃⌘⎵) to trigger the Emoji & Symbols input. Then, I would type in a, e, i, o, u or v (for ü) in the search bar and then manually select my input.

Third party input

It was getting a little tiresome and I figured I would use create an abbreviation in Typinator to automatically expand with the tones. Now, I considered using the the macOS native text replacement function. That works just as well. However, given that there are four tones for each of the six letters, I would have to create 24 entries and I would prefer to group them all under a set in Typinator.

The other advantage Typinator has over native text replacement is the ability to use AppleScript and other advanced features such as automatic custom input, variables and custom control functions. Check it out if you’re interested to upgrade your typing.

About a third of the way through creating the Typinator entries, I found myself questioning whether this was something that should have been built into macOS. In other words, I was lazy. So I did a quick DuckDuckGo search and found that macOS is able to do this in a simpler, faster way.

Built-in macOS input

Those of you who input text beyond English on macOS probably already know this. Open System Preferences > Keyboard > Input sources. Click on the + to add a new input source. Under English, add ABC – Extended. Remove the default ABC since you now have a more powerful input source.

The extended input source lets you add a diacritic to a letter in two easy steps.

  1. Press option and the corresponding diacritic key. The diacritic appears.
  2. You can press space to just use the diacritic as is, or you can type your desired letter a, e, i, o, u or v (for ü).

This is the only part that requires some effort: memorising the diacritic key.

First tone (¯)

First tone high-level flat tone is represented by a macron (¯).

Press option + A (⌥ A) followed by the desired letter.

For example, option + A (⌥ A) followed by a gives ā.

Second tone (´)

Second high-rising tone is represented by an acute accent (´).

Press option + E (⌥ E) followed by the desired letter.

For example, option + E (⌥ E) followed by e gives é.

Third tone (ˇ)

Third falling-rising tone is represented by a caron (ˇ).

Press option + V (⌥ V) followed by the desired letter.

For example, option + V (⌥ V) followed by v gives ǚ.

Fourth tone (`)

Fourth falling tone is represented by a grave accent (`).

Press option +` (⌥ `) followed by the desired letter.

For example, option + ` (⌥ `) followed by o gives ò.

Umlaut u (ü)

You can also input the letter u with an umlaut (ü) using option + u (⌥ U) followed by u.

Uppercase

If you wish to input the pinyin in uppercase, simply hold down shift when you key in the letter.

For example, option + A (⌥ A) followed by shift + a gives Ā.

If you have any more tips that I missed out, let me know and I’ll update this page.

Learn with me.

Join me in my journey in exploring the transformative potential of AI.