Thanks to some helpful guides on the Internets, I managed to finally get my installation of FreeBSD to type Japanese. The technology has definitely come a long way since I last tried this a few years ago, and documentation hasn’t always caught up with the changes, but some brave folks have posted their experiences for others to read, so I wanted to share what worked for me.
Some background first on my system:
- OS: FreeBSD 7.2, running virtually on my Mac via Parallels.
- Using GNOME 2.26 as my window manager.
- Using public-domain Korn Shell (pdksh) as my user-shell. Any Bourne-shell derivative would work too. For some reason, I couldn’t make this work with C-Shell derivatives, probably because I am not setting environment variables right. Comments appreciated.
So, as of writing, FreeBSD provides both the SCIM and Anthy applications. These go hand-in-hand because SCIM provides the common platform for inputting East-Asian languages, while Anthy is what actually lets you type Hiragana, Kanji and such.
If you use FreeBSD packages, you should install the following applications:
pkg_add -r scim ja-anthy ja-scim-anthy ja-kochi-ttfonts ja-kasumi
The last two, ja-kochi-ttfonts and ja-kasumi, are optional, but highly recommended. The Kochi TrueType fonts make Japanese look better, and Kasumi is a kana dictionary.
If using the ports collection this can be done instead by doing the following:
- Go into
- Go into each of the follow sub-folders: scim-anthy (installs “scim” too), anthy, kochi-ttfonts, kasumi, and for each one compile like so:
make && make install && make clean
Notice that the names in ports are slightly different than the packages. This confused me at first, but the end-result is the same. If all five applications are installed, you’re half-way there! Now, you need to do some configurations.
First, you should set X to use your fancy new TrueType fonts. Edit
/etc/X11/xorg.conf and add this line just after the other
Note that for xorg.conf to read the file correctly, there must be a “tab” before FontPath, or it may not be read correctly. Better safe than sorry.
Now, you need to configure the environment variables. Without these variables set for your account, X will not know what to do with SCIM-Anthy. Set the follow variables in your
.profile file for Bourne Shell and derivatives:
If using csh or tcsh, then it’s:
setenv XMODIFIERS @im=SCIM
setenv GT_IM_MODULE scim
setenv QT_IM_MODULE scim
setenv LC_CTYPE ja_JP.eucJP
You could also set
ja_JP.UTF-8, but I’ve found from experience that eucJP just works better for the time being.
Meanwhile, in my
.xsession file I add the following line:1
Which tells SCIM to run in the background, in daemon-mode. Now, if you log into GNOME either through GDM or from command-line, a small keyboard icon should appear beside the clock. If not, then SCIM is not running.
Now try to run a program like
gedit or even Firefox. If you hit CTRL+Space2 then a small box with Japanese characters will appear to the bottom right. Start typing a word in romaji like “nihongo”, then hit Space to select what kanji you want, and finally Return key to select your choice. You can see an example of this here with a screen shot from my virtual FreeBSD machine:
Best of luck!
P.S. Typing this late night rather than doing the dishes. My wife would be appalled. 😉
P.P.S. Pro tip: if you’re a pdksh fan like me, you can enable tab-completion on FreeBSD by adding two lines to
Just to be sure, you might have to log out entirely first for it to take effect, or at least run them on the command-line just once test. Felt like adding this to the post since I’ll forget later, and it’s too small to justify its own post.
.xinitrc if you’re booting X from command-line, not using GDM or something similar.
2 If you’re running virtually on a Mac like me, then you should disable the CTRL+Space shortcut key on Mac OS, otherwise it will trigger Spotlight instead. Or configure SCIM to use a different hotkey. Both options seem to work. Me? I never use Spotlight anyways.