跳轉至

Fcitx5 macOS

Fcitx5 input method framework ported to macOS.

Public beta: please download installer.

小企鹅输入法 macOS 版

Fcitx5 输入框架的 macOS 移植。

公测进行中,请下载安装器

Build

Native build on Intel and Apple Silicon is supported.

This is NOT an Xcode project, but Xcode is needed for Swift compiler.

Install dependencies

You may use nvm to install node, then

Bash
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
brew install cmake ninja extra-cmake-modules gettext nlohmann-json
./install-deps.sh
npm i -g pnpm
pnpm --prefix=fcitx5-webview i

Build with CMake

Bash
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
sudo cmake --install build

Code sign

Some features (e.g. notifications, core dump) require the app bundle be code-signed after installation:

Bash
sudo /usr/bin/codesign --force --sign - --entitlements assets/core.entitlements --deep /Library/Input\ Methods/Fcitx5.app

Debug

Console.app

  • Check Include Info Messages and Include Debug Messages in Action menu.
  • Put FcitxLog in Search.

Log

/tmp/Fcitx5.log contains all log in Console.app, plus those written to stderr by engines, e.g. rime.

lldb

SSH into the mac from another device, then

Bash
$ /usr/bin/lldb
(lldb) process attach --name Fcitx5

Core dump

Bash
sudo chmod 1777 /cores
sudo sysctl kern.coredump=1
ulimit -c unlimited  # only works for current shell
pkill Fcitx5; /Library/Input\ Methods/Fcitx5.app/Contents/MacOS/Fcitx5

When Fcitx5 crashes, it creates a ~10GB core file under /cores.

Bash
/usr/bin/lldb -c /cores/core.XXXX
(lldb) bt

Plugins

Fcitx5 only packages keyboard engine. To install other engines, use the built-in Plugin Manager.

Translation

Swift sources

To update .strings files for each supported locale, run

Bash
cmake --build build --target GenerateStrings

This will, e.g., update assets/zh-Hans/Localizable.strings, and then the translator can work on it.

C++ sources

First, create assets/po/base.pot file:

Bash
cmake --build build --target pot

To add a new language, do

Bash
cd assets/po && msginit
and then add this locale to assets/CMakeLists.txt.

Then, use a PO file editor to translate strings.

Finally, to merge new strings into PO files, do

Bash
cd assets/po && msgmerge -U <locale>.po base.pot

Credits