Configuring Rime Input Method on macOS

Installing Rime

Recently, I learned from Teacher fernvenue how to configure input methods on Debian GNOME and found that Rime is also applicable on macOS. Configuring Rime/Zhongzhouyun on macOS is just as straightforward.

Firstly, visit the Rime official website and directly download the installation package for Squirrel.pkg. After installation, the system will prompt you to either log out and log back in or manually log out and log in again.

Then, navigate to System Preferences > Keyboard > Text Input > Edit, and search for “Chinese” to add “Squirrel” to text input options. Now you can switch to Squirrel by switching input methods.

Downloading Dictionaries

The usability of an input method heavily relies on dictionaries. Here, I simply and directly added the dictionaries from Luna and Chinese Wikipedia, which should cover most of the input needs.

For the Luna dictionary, it can be found in this repository. Simply download luna_pinyin.dict.yaml. For zhwiki, it can be found here.

Download the latest update, for example: zhwiki-20240210.dict.yaml.

In macOS, Rime’s configuration path is generally at ~/Library/Rime/. You can also directly open the configuration folder by clicking “User Settings…”. Place luna_pinyin.dict.yaml and zhwiki.dict.yaml into this folder.

Configuring Dictionaries

Furthermore, to add multiple dictionaries simultaneously, you need to configure specific schemas.

Firstly, create a default.custom.yaml file.

patch:
  schema_list:
    - {schema: luna_pinyin}

Taking luna_pinyin as an example, create a customized user configuration that applies to luna_pinyin.

patch:
  translator/dictionary: personal

Then, create personal.dict.yaml for this configuration.

---
name: personal
version: "20240214"
sort: by_weight
use_preset_vocabulary: true
import_tables:
  - luna_pinyin
  - zhwiki
...

Now you should have these files in ~/Library/Rime/ or the user configuration folder.

$ ls ~/Library/Rime/
build	luna_pinyin.custom.yaml	personal.dict.yaml
default.custom.yaml	luna_pinyin.dict.yaml	zhwiki.dict.yaml user.yaml
installation.yaml	luna_pinyin.userdb 

Since we’ve already placed the luna and zhwiki dictionaries in the user configuration folder, clicking “Deploy” in the input method settings should make them effective immediately.

Switching Input Methods

You can switch input methods using F4, for example, switching between Simplified and Traditional Chinese input methods.

Automating Dictionary Updates

To ensure that my input method learns my typing habits and keeps the dictionary up-to-date, automating dictionary updates is the best choice.

I created a rime-dictionaries repository on GitHub. Through GitHub Action, it automatically synchronizes all the dictionaries I use to the latest version every day.

Then, using macOS’s built-in Shortcuts, I added an automation script.

cd /Users/bdim404/Library/Rime && git pull
echo "macOS Rime updated."

I made this Shortcut into a button on the desktop. Now, with just one click, the input method’s dictionary is automatically synchronized to the latest state, making it very quick and convenient.