Inputting Japanese text in Linux and some BSDs

Table of Contents (TOC)

CentOS-5x and similar (RHEL-5, SL-5, OEL)
CentOS-6x, 7.x, and similar
CentOS-8-9x, AlmaLinux-8-9x, and friends
Fedora (21-38)
Lubuntu and Ubuntu (14.04, 15.04-21.10)
Linux Mint (Rebecca, Rafaela, Rosa, Sarah, Sonya, Sylvia, and Ulysa)
Debian Jessie and Stretch
Arch Linux

First, the disclaimers--Japanese in Linux and the BSDs constantly improves, and parts of this page are often deprecated. If you find any errors here, feel free to send an email to scottro11[at]

When this page was first begun, around 2002, it was one of the few of its kind and there were far fewer distributions to follow. In many cases, you are now better off going to the main forum for your distribution, and looking for recent tutorials there.

It used to be far more difficult to get Japanese working. Nowadays, one can just go to, choose Japanese as the source, and begin typing phonetically, it will work like most Japanese input engines, one types for example, s-h-i on a US or other keyboard, sees the hiragana for shi, then gets kanji options by hitting the space bar.

Although this article mostly covers using Japanese in X, one can actually, with ibus-fbterm and fcitx-fbterm, and framebuffer, input Japanese in console. (There are others, but fcitx-fbterm is the only one covered here.) For a concise roundup of input methods this article gives a very good summary. It's from 2011 but still pretty accurate.

I most frequently use Japanese in an xterminal with things like vi and mutt, a browser, and an editor such as OpenOffice. Therefore, these are often the only things that I checked. In most cases, if it works in these applications, it will also work with thunderbird and the like.

The kinput2 cannaserver combination used to be the input method of choice. Then it was scim-anthy. Then ibus-anthy and after that, ibus-mozc. Then came fcitx, which is what I'll be covering through most of this article save for CentOS-5 (EOL), CentOS-6, which doesn't have fcitx as far as I know, and OpenBSD prior to -current snapshots after 6.2. OpenBSD only got an fcitx-anthy package for snapshots after 6.2

Ibus has changed its ctl+space default to change between English and Japanese to Windows key+space. Perhaps they wanted to imitate Apple--though with Apple these days, cmd+space opens its search function unless you disable that. Possibly they decided it was harder to hit by mistake. Using ibus-setup, you can change it back to ctl+space.

Unfortunately, changing the shortcut to Windows key+space frequently conflicts with other keyboard shortcuts--for example, in dwm, if one changes the default mod key from alt to the Windows key--Fedora, among others, uses the Windows key instead of alt--Windows key+space is used to change layouts. Others have reported ibus failing to work due to some conflict with the keyboard shortcut. If one runs ibus-setup, there is a box showing the default of Windows Key (or Mod4)+space. If you click on the little box to the right of the textbox showing that, another dialog opens up, with the word Modifiers next to a few check boxes. The user can then use Control (or any other of the choices that they prefer), click apply, then OK.

The ibus page is here, but, at least for Japanese, the instructions are a bit lacking. For most of this, we're going to be using fcitx, ususally with mozc. In many cases, I have problems working with ibus in anything but Gnome, so I no longer use it.

If something's not in the table of contents, which I just added in June of 2015, it means I haven't worked with that system since 2015 or earlier.


CentOS-5.x and similar (RHEL, Scientific, OEL)

(Last update October, 2013)

CentOS-5x is now end of life and the user is advised to update
For 5.x The scim-anthy package is available from the standard CentOS repos. One can choose to install Japanese support during installation, or just install needed packages afterwards. As RedHat based distributions tend to throw in everything you might possibly need under any circumstances, you might prefer to not select Japanese support during installation and just add scim-anthy afterwards.

Install anthy, scim and scim-anthy

yum install scim-anthy
This will pull in scim and anthy as dependencies.

If you always want Japanese immediately available, add these lines to your .bash_profile. (For the newcomer, these two files are located in your home directory. That is, if your user name is john, they'll be found in /home/john, often referred to as $HOME or even ~. Note that they are dotfiles, that is, they have a period in front of them, so if using one of the graphic text editors, you might have to specify that it show hidden files or show all files. I haven't used such editors in years, so I'm not quite sure of the latest way to do that.)

export XMODIFIERS='@im=SCIM'
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
export LC_CTYPE=en_US.UTF-8
scim -d
The above assumes that United States style English is your default language.

To put them into effect immediately

source .bash_profile

You should see a message that scim is running. (However, this doesn't always work--if it doesn't, just log off and log on again.)

With UTF-8 as your default encoding, theoretically, you shouldn't even have to set LC_CTYPE to ja_JP.UTF-8. You should be able to use your own language, e.g en_US.UTF-8. My experience has been that sometimes this works, and sometimes it doesn't. I would actually try setting LC_CTYPE to your own language (in my case, en_US.UTF-8) and seeing if things work properly. If they don't, then change LC_CTYPE from your native language to ja_JP.UTF-8.

Now when you start most applications, hitting ctrl+space will open up a little scim panel in the lower right of the screen. If you enter english text, you will see hiragana appear. If you hit the space bar, it will select kanji. Note that the panel should have the word Anthy on it. If it doesn't click the words RAW CODE or English whatever and you should have an option for Japanese=>Anthy.

Using scim-anthy you should be able to use Japanese in most applications. If you have trouble inputting Japanese in an xterm, if, for example, you're using vi or mutt, use uxterm. (This can be called by simply typing uxterm from any command line.)

At some point, I got into a habit of only calling these variables when I needed them, and made a little script.

XMODIFIERS='@im=SCIM' LC_CTYPE=en_US.UTF-8 ${1+"$@"} &

Then, I might call mutt, for example, with mutt

Whether or not this saves on resources, it became a habit.

If you choose to do it this way, it's not necessary to have the XMODIFIERS and LC_CTYPE lines in .bash_profile.

The advantage to this format is if you want to pass more than one argument, that is, put more than one command in. I don't want to make this a treatise on shell scripting, but if for example, I use urxvt as my terminal. I may want to call it from a fluxbox menu with a black background and white text. Its default is white background with black text.

For those with an interest in shell-scripting they can find a detailed explanation here. It was written by Cameron Simpson who has frequently helped me with scripting questions.

I've found that I can usually get away with leaving out the GTK and QT IM_MODULES variables, although it's probably better to include them.

This can be a bit confusing as it varies from distro to distro and application to application. Sometimes, one doesn't even need the LC_CTYPE line, if your distro's default is en_US.UTF-8. One has to play with the variables and see what works for their distribution or O/S of choice, as well as their favorite applications.

If you wish your menus and the like to be in Japanese as well, you can add, either to the script or your .bash_profile


Now, most applications will also work in Japanese--some things may show up as mojibake (gibberish) but you will be able to use Sylpheed, xchat (an irc client) etc in Japanese without problem. You'll also be able to input kanji as text in GIMP.

On rare occasions, I've found that the Ctl+space hotkey combination wouldn't open up the scim widget, although clicking on the icon that would come up when it was started would work. Scim creates a $HOME/.scim/config file which should have the line
/Hotkeys/FrontEnd/Trigger = Control+space

If that line is missing from the config file, add it. In some recent Fedora versions, the $HOME/.scim/directory was never created. In that case, one creates the directory and config file--the config file only needs that one line.

If using Gnome, and gnome-terminal, one can right click in the terminal, opening a menu that includes input method. One can choose scim from from that menu. If you didn't choose Japanese support at installation, you will also need fonts. You can try doing
yum search fonts-ja

which should give some choices. Once fonts are installed, there should be no problem. In CentOS, for example, one will find ttfonts-ja. This section was last updated in 2015. At the time OpenOffice-3 didn't work with scim for many people. I don't know what happened with later versions of OpenOffice, or if everyone changed to LibreOffice. CentOS-5x is EOL, so someone having issues is advised to upgrade.


CentOS-6.x, 7.x, and similar

(Last update August, 2017)

In CentOS 6 (and 7.x, if desired, but 7.x has fcitx-anthy), one installs ibus-anthy, and can then add the suggested lines to .bashrc.
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus

Then run ibus-setup. It will probably tell you the daemon isn't running and ask if you wish to run it. Click yes. It will then give you a message to put the variables listed above into $HOME/.bashrc. Once you've clicked OK, it opens a dialog box with the tabs General, Input Method and Advanced. Generally, at least in RHEL6 and friends it shows Control+space as the hotkey combo. 7.x has the Super key, but it can be changed by clicking the ... next to the text box saying space, and in the new dialog box, unchecking super and checking Control, clicking Apply, then clicking OK. Click input method.

There is a box to select an input method. It should, when you click it, show Japanese and Anthy. Click Add and it should now show Anthy as an input method.

In CentOS-7.x (and possibly 6 as well, it's been awhile since I set it up there, so I've forgotten), when you click Input Method, you then have to click the checkbox for Customize active input methods. Then click the line at the bottom of the box that reads Show all input methods. This, somewhat annoyingly, takes you back to the original box where you once again click Select an input method. When you get to Japanese, there will be an option for anthy, click that. Click add. Then click close.

If one takes the default Gnome desktop, or the KDE one also offered, there is no problem. However, if like myself, you prefer to do a minimal installation, then add X, then add a window manager such as fluxbox or openbox, you'll find that ibus won't work.

The trick seems to be to also install dbus-x11. After installing it with yum -y install dbus-x11, ibus-anthy seems to work as expected in most applications. I filed a bug at bugzilla, and it is already fixed in Fedora 14. If not, simply installing dbus-x11 should fix the issue. Apparently, it won't make it into RH 6.0 (and therefore CentOS 6.0 and Scientific Linux 6.0. See the RHEL bug on bugzilla for status updates.

You will also need fonts. A few that I use.
yum install ipa-mincho-fonts ipa-pmincho-fonts vlgothic-fonts vlgothic-p-fonts

So, once dbus-x11 and fonts are installed, the variables have been added to $HOME/.bashrc, and ibus is running, you should be able to input Japanese in most applications that accept it. Sometimes, you may have to restart it with ibus-daemon --xim & to get it to work with terminals, but it will usually work with firefox, libreoffice, and gnome-terminal. On a CentOS-7.x install, I find that to get it to work with urxvt I may have to specify variables in the command, like

XMODIFIERS=@im=ibus LC_CTYPE=en_US.UTF-8 urxvt

Other times, I haven't. Other terminals, like xfce4-terminal or gnome-terminal, work without problems.

Additionally, friends who use Gnome as their desktop, have mentioned that they have no problems.

In CentOS-7.x, fcitx-anthy is in EPEL. So, if you add the epel repos,

yum install fcitx-anthy

This will pull in the things you need, but if you're running a minimal X install, like dwm or openbox, you also need to install dbus-x11. You'll also want fonts as mentioned above.

Prior to it getting into EPEL , I rebuilt a Fedora-20 srpm for CentOS-7, so if you trust me, you can get my fcitx-anthy-0.2.0-2.el7.centos.x86_64.rpm here. I just leave it up in case it goes away from EPEL for any reason. As things are, there's no reason to use it.

Once fcitx-anthy is installed, we can get it working as we do with other distributions. Start X, run fcitx -d -r and then stop X. Go to $HOME/.config/fcitx and edit the profile file, changing anthy:False, to anthy:True, restart X and it should work.

Depending upon your usage, you can put the lines for fcitx (or ibus) in .bashrc. Then one drawback is that if you start a terminal with a keyboard shortcut, as I do in both openbox and dwm, it won't read .bashrc, so won't work with that terminal. If, however, I open a urxvt terminal with a keyboard shortcut, and, from that terminal call another terminal, it works without problems. I boot into textmode then run startx, so I just put the 3 lines in .xinitrc above the line calling the window manager. In other words, my .xinitrc will read
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export LC_CTYPE=en_US-UTF-8
exec dwm

If using ibus, substitute ibus for fcitx. The other option is to use .bash_profile, which is read when you first login. Then it doesn't matter if it's started from a keyboard shortcut as the variables are already in place. TOC

CentOS-8-9, Almalinux-8-9, and friends

(Last update June, 2022)

RedHat and CentOS-8, have an fcitx-anthy package that can be used. If you choose the server edition, which is the default, it has a Gnome GUI, and ibus works without problem if one follows RH's article on enabling Asian language input. Note that their page says one should install @im which brings in all input managers but all you need is is ibus-kkc. This will pull in all necessary dependencies--if you're using Gnome. The RedHat article, though it doesn't mention it, is using ibus.

I prefer to use a lighter weight window manager, usually either dwm or openbox. One can install fcitx-anthy. Sometimes, you may need to start it with fcitx -d -r or it doesn't work in urxvt. (If one just uses fcitx -d it will work with firefox and other gtk apps, but not in urxvt, unless you start it with ibus-daemon --xim).

There doesn't seem to yet be an fcitx-config so if using it I use what has been the simplest method for me. I startx and run fcitx -d -r. I then kill X and go into ~/.config/fcitx/profile. There is a long, long list of currently enabled input managers. all marked False. One of the first is anthy, right after the fcitx-keyboard entry. Change the anthy:False to anthy:True. Once again startx and run fcitx -d -r. Now if you hit ctl+space, you should be able to input Japanese. Again, if you use RH's preferred Gnome, you can, instead, use their article linked above. In Gnome, it works without problems.

RHEL9 and clones haven't been out that long. There is, right now, no rpm for fcitx or fcitx-anthy (or fcitx-kkc). There is an ibus-anthy available. There is a request for an fcitx package on bugzilla. The original request was from 2017, I just updated it in June of 2022, asking for fcitx for RHEL9 and friends.

There is a flathub flatpak package for fcitx5 and an addon for mozc, but I haven't tried it at time of writing. If I do, I'll update.

Even in a standard workstation install, setting up is slightly different than RHEL8. In Gnome, once you type in language, you have to click the keyboard on the left hand menu (when the language menu comes up, and choose to add Japanese and Anthy from that menu. There will be something showing English with a plus sign underneath, clicking the plus sign gives the option to add Japanese and then anthy. But the first screen shown when you select language, just shows your default language. To be able to add an additional one, you have to select keyboard and add it there.

If using a minimal install, it's a bit more work. First, I use dnf to install ibus-anthy. I start openbox from a text login with startx. My .xinitrc contains the lines
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export LC_ALL=en_US.UTF-8
ibus-daemon --xim &
exec openbox-session

If I leave out the --xim, I can get Japanese in firefox and other gtk apps, but not in urxvt, my preferred terminal. I have noted, thanks to posts on Fedora Forums, that the xfce4-terminal works without having to add the --xim option. It seems to offer the benefits of gnome-terminal with less cruft. It is available from the EPEL repo.

To set it up, I run ibus-setup, and when I click input method, English shows as there already. I click add, and am given various languages, including Japanese. I click that, and anthy is shown as an option. I click add, and it's set. Only RH and clones don't have a working fcitx for their latest versions. At time of writing, there is only ibus-anthy, no ibus-kkc or ibus-mozc.

However, I suspect the average desktop user of RHEL9 and clones will run Gnome, in which case, ibus will easily work. So, until EPEL or other adds an fcitx rpm, it is necessary to use ibus.



(Last update, July, 2023)

Fedora's workstation comes with ibus, however, we're going to use fcitx. As we're using Fedora 36, we'll use dnf rather than yum. F34 is the first of the Fedora's to have mozc, so we'll use that. One has to use fcitx5, aside from that, there is little difference. Earlier versions can use fcitx-anthy or fcitx-kkc.

I should mention that like CentOS and clones, if one choose the default Gnome workstation, it is probably easier to use ibus. Refer to the RedHat page mentioned above. As mentioned before, one doesn't have to do install @im just ibus-mozc which will pull in all dependencies. However, if one uses other desktops or windowmanagers besides Gnome, keep reading to use fcitx instead. As described here, as anthy has been dead upstream, libkkc was also moved into Fedora. This means that one can use fcitx-kkc if they prefer. When manually editing ~/.fcitx/profile, it shows as kkc).

If using Gnome (which I don't) the user can look at this page about changing the default input manager. As of July 2015, its information for F22 is incorrect, but hopefully will be fixed. I have the correct method below.

The steps given at the end of this section are only needed with Gnome3 itself, not Mate or Cinnamon. The Arch Linux wiki article on fcitx gives some other suggestions for using it with Gnome, but as you'll see below, it's not that big a deal. There are a couple of extra steps. I don't use Gnome, I was just surprised to hear that it was a problem, so tried it for myself. It isn't a problem with Ubuntu's Unity,Mint's various desktops, or Fedora's Mate. I didn't try with Fedora's Cinnamon but I suspect it's not an issue there either.

The first method given here also works with the XFCE and LXDE spins, as well as my preferred minimal install

I use Fedora by booting into text mode and running startx to either openbox or dwm. In such a case, the procedure is quite simple.
dnf -y install fcitx-anthy

This should pull in all dependencies. However, note that as mentioned above in the CentOS section, if you are running a more minimalistic environment, using, for example, fluxbox, it fails to pull in dbus-x11, so you will need to install that as well with dnf -y install dbus-x11.

You will also need fonts. I usually install vlgothic-fonts, vlgothic-p-fonts, sazanami-mincho-fonts and sazanami-gothic-fonts.

I add to my .bashrc
export LC_CTYPE=en_US.UTF-8

I boot into text mode and run startx, so I put these in my .$HOME/.xinitrc. With Fedora, while trying with the LXDE and XFCE spins, I either used the im-chooser GUI which is included with both spins, or running sudo alternatives --config xinputrc. Either method edits the /etc/X11/xinit/xinputrc which is a symlink to /etc/alternatives/xinputrc which is a symlink to /etc/X11/xinput.d/<your_chosen_im>.conf. The difference seems to be that using im-chooser does more, as if you use it, fcitx will start with your next Xsession, whereas if you use alternatives --config you will have to manually start it.

If doing it manually, as I do, insert the following to $HOME/.xinitrc above the line calling the window manager.
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

If I want it to start each time I start X, I can add fcitx -d -r below the export (but above the line to exec the window manager). (If using fcitx5 then change that to fcitx5 -d -r

Fedora is a bit confusing with fcitx. Its installation of fcitx includes an fcitx-configtool, but there's also a separate fcitx-configtool rpm, which is what we want. After installing fcitx, also run dnf -y install fcitx-configtool. Otherwise, you'll get a message that it couldn't be found and it will now try to open config with a default text editor. This isn't what you want, as it will open $HOME/.config/fcitx/config and what we need to edit is $HOME/.config/fcitx/profile.

So, we've installed the separate rpm, fcitx-configtool. While in X, first start fcitx. You can do this by just typing fcitx in a terminal. You can also use fcitx -d which will run it in the background.

Once again, I'll remind you that if you're using fcitx5 you may have to specify fcitx5, rather than fcitx.

Now run the command fcitx-configtool. It opens up a dialog box. It should show something like Keyboard-English.

For versions prior to F34, Click the plus sign at the bottom left. Uncheck the default Only Show Current Language. Type anthy in the search box. It sometimes now appears at the top, or may not appear until you click OK. Once you do, you should be back at a window now showing Anthy underneath the Keyboard-English. Close the box. You may have to use your window manager's method to close, e.g., by default alt+F4 in openbox. You may have to log out, but probably not. Hit ctl+space and see if a little box marked anthy appears, (If it doesn't, log out and log back in.) You can now enter romaji and have hiragana appear. Like most input editors, hitting the space bar will give you choices of kanji.

For fcitx5-mozc, use fcitx5-configtool. Again uncheck only show current language (at lower right). In the search box, type mozc. It will show Japanese and under that, mozc. Click mozc and then click the left pointing arrow, which should move mozc to the left side under where it says Keyboard English (US), assuming that's the keyboard you're using.

With fcitx, as opposed to fcitx5, to configure an input manager manually, edit $HOME/.config/fcitx/profile. If using a GUI login manager, such as with the LXDE spin, fcitx may already be running if you log out and log back in. Otherwise, once X is started, start fcitx with the command fcitx -d. You should see that it's started, but Japanese input may not work yet. Stop it with pkill fcitx.

If you start X manually with startx, then just kill it. If you use a login manager, log out, then use ctl+alt+F2 to get to a console prompt, where you can put in your username and password.

Make sure that ctl+space isn't used for anything in your window manager, because it's fcitx's default key for switching. I believe you can change that in $HOME/.config/fcitx/config but I've not tried to do so. The below is for earlier versions. We'll get to fcitx5-mozc afterwards.

There should now be a file in $HOME/.config/fcitx called profile. Edit this $HOME/.config/fcitx/profile with your favorite text editor. Look for the words

and change it to read anthy:true. The file has very long lines--if you open it with vi, for example, you may not even see the word anthy, just what appears to be the end and some @ symbols. Search with your text editor's search function and the anthy:False should be in there.

Go back into X, either by running startx or using ctl+alt+F1 to get to your login manager. If fcitx isn't running, start it again with fcitx -d -r. The -d makes it run as a daemon in the backround, the -r is for restart, in case it is running already.

If you use openbox, even if you boot into text mode and run startx, fcitx may automatically start running when you start X. If you don't want this, look in /etc/xdg/autostart. There should be an imsettings-start.desktop file. Near the end of the file is an Exec line that will start fcitx. You can comment out that line, or just rename the file.

As for Gnome, as it uses ibus by default, a few extra steps are necessary if using fcitx. Once fcitx-anthy (or fcitx-kkc) and fcitx-configtool are installed, first disable ibus integration, then switch im-settings. Once that's done, fcitx gets started and we can add anthy. The first step is to run
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"

This disables ibus integration.

Run the command fcitx-configtool, and pick anthy as we've described--click the plus sign at lower left, uncheck the box that says to only show current language and type anthy in the search box. It might not appear at top, but the OK button should be clickable. You should now see anthy is available.

Again, if you choose kkc it will show Kana Kanji when you type in kkc.

You should be able to switch between normal and Japanese input with ctl+space. If not, log out and log back in.

Although ibus will still be running, you'll be using fcitx. If you like, you can rename /usr/bin/ibus-daemon to something like /usr/bin/ibus-daemon.bak. This will stop it from running and in my brief test with Gnome, didn't break anything. Don't remove ibus as that will break Gnome.

Apparently, in Wayland, which is now the default in Fedora's Gnome, the export lines (for XMODIFIERS, GTK_IM_MODULE and so on) should be either added to /etc/environment or /etc/profile. The information is from the Arch wiki.

With an install of Fedora and Gnome that was running Wayland, however, I didn't have to add in the variables, it just worked.

However, when I tried labwc, a window manager that is supposed to run like openbox but in wayland, putting them in /etc/profile didn't work. It did work if I put the environment variables in ~/.bashrc and started terminals from their equivalent to dmenu, bemenu. As labwc is quite buggy at time of writing, I didn't investigate further. In short, if using Gnome, once you set it up, as described above, neither Gnome nor openbox required me to put the variables anywhere, it just worked as soon as I started fcitx5. With both Gnome and openbox, I had to start it manually with fcitx5 -d. Before Wayland, one could simply use imsettings-switch fcitx, but it doesn't work with Gnome and wayland, and, to be honest, I don't use Gnome enough to research a fix. I just wanted to check how to get fcitx working with Gnome in F34.

With Fedora34, on a simpler install, starting with a minimal install and then installing X and openbox afterwards, the process is slightly different. Install fcitx5-mozc and some fonts, e.g. vlgothic-fonts. One can install the fcitx5-configtool, but if you've done a relatively minimal install, it's just as easy to edit it manually. In X, start fcitx5 in daemon mode with fcitx -d. Then, quit X, and in ~.config you should have an fcitx5/profile file. Rather than the long file you have with regular fcitx, this one is relatively short. Some of this will already be there, but edit it so that it reads
# Group Name
# Layout
Default Layout=us
# Default Input Method

# Name
# Layout

# Name
# Layout


Once you've done this, run startx, start fcitx5 -d, and you should be able to input Japanese with ctl+space. Note that this is in .config/fcitx5. There will also be a .config/fcitx but it only has a dbus directory. Note that if you want to use anthy or kkc, you can follow the other instructions, or, you can use fcitx5 with anthy or kkc, there are packages for both. TOC

Gentoo Linux

(Last update, December, 2017)

Gentoo has its own pages on Japanese, fcitx, and urxvt, my terminal of choice, and much of this is gleaned from those pages. Gentoo's own pages are slanted towards ibus.

You'll see I add the xft USE flag to rxvt-unicode. When I didn't, it gave me issues, such as inputting Japanese but then showing blank squares. Rather than font-hunting I emerged again with the xft USE flag and everything worked. Also, if you choose to specify fonts in .Xdefaults, It's a lot less typing if you use xft.

So, when installing urxvt (which is one of the first things I do anyway, as it's my terminal of choice), include the xft USE flag.
USE="xft" emerge rxvt-unicode 

One font that works well with it is the TTF ipa-mincho font.
emerge ja-ipafonts 

You will also need dbus and we are using fcitx-anthy. There isn't an ebuild for fcitx-mozc, and I didn't try to get it working as an input method.
emerge sys-apps/dbus

The sys-apps part may be unnecessary, but won't hurt and at one point there was also a haskell-dbus. The last time I tried this, I forgot it with no ill effects, but things can always change.

We want gtk and qt4. If you don't have them as default USE flags, temporarily enable them for this.
USE="gtk qt4" emerge fcitx-anthy

It may be necessary to add lines to /etc/portage/package.use. For example, at one point I got a message that I had to add =x11-libs/cairo-somenumber X. If you're not familiar with package.use, it's a file under /etc/package. Sometimes, a directory containing files. In that case, I just added the line
x11-libs/cairo X

to /etc/portage/package.use. In my case, there was already a directory, not a file, called package.use, but I just renamed it with no ill effects. It had a file called iputils so I kept that in case it was needed again. This probably isn't best practice, but it worked. See the wiki section on package.use The last time I did this, however, that wasn't necessary.

The emerge may take quite awhile, especially if this is your first time with gtk and/or qt4 USE flags.

Add the following to .xinitrc if you use startx or SLIM and .xprofile if you use GDM, KDM, or LightDM.
eval "$(dbus-launch --sh-syntax --exit-with-session)"
export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx

If you didn't put in the USE flags for gtk and qt4 than the GTK_IM_MODULE and QT_IM_MODULE should use xim instead of fcitx. So, change your .xinitrc (or .xsession)
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim

Now, startx and start fcitx. Once it's running, kill X and edit $HOME/.config/fcitx/profile. Look for where it says anthy:False and change that to read anthy:True. Then start X again and it should enable you to input Japanese in applications that allow it.

If, for some reason GTK or QT apps aren't allowing you input Japanese, try changing their input module to xim. You can do this on the command line
GTK_IM_MODULE=xim libreoffice

If that works, it means you may have forgotten or mistyped when trying to emerge them with gtk and/or qt4. You can either emerge again, this time being careful to either add the USE flag at command line or in /etc/portage/make.conf, or just change your GTK_IM_MODULE and QT_IM_MODULE lines to read xim instead of fcitx. (Leave the XMODIFIERS line alone).

(You can also use /etc/portage/package.use but I find one of the other two methods quicker for me.)

While it's not necessary, (unless you have some oddity and urxvt is not properly displaying fonts), you can use this in your .Xdefaults.
URxvt*font xft:IPAMincho:size=12

This works for me, the reader may have other font and font size choices.

After starting X, you can start fcitx with fcitx -d -r.

With some window managers, such as openbox, it may autostart.


Lubuntu and Ubuntu

(Last update December 2021, Lubuntu 14.04, Lubuntu 15.04-17.10, Ubuntu 15.04, Ubuntu 16.04, Ubuntu 17.10, Ubuntu 20.10, Ubuntu 21.10)

For Lubuntu 15.10, fcitx is the default input manager. First add Japanese language support by going to Preferences=>Language Support, picking Japanese by clicking the checkbox by it, then clicking Apply Changes. This will download some additional language packs. Install fcitx-mozc.
apt-get install fcitx-mozc

The dialog box opened when you choose Language Support (that you used for installing Japanese support) has a line for Keyboard input method system, set to none by default. Click the dropdown box and choose fcitx. Log out and log back in, and you'll see a little box on the bottom bar, with the letter a.

Choose Configure Current Input Method. In the box that opens, uncheck the box saying Only Show Current Language. Scroll down to Japanese and if you click on it, it should expand, showing mozc as a choice. Click on it. There isn't an Ok or any indication that it's saved your choice, but once you close the dialog box, if you hit ctl+space you will be able to enter Japanese.

Prior versions of Lubuntu come with ibus already installed, but it's easy to switch to fcitx. This is what I did on 14.04 and 15.04
sudo apt-get update
sudo apt-get install fcitx-mozc

When you run im-config, the first message tells you that you should only have one input manager installed. While you can uninstall ibus, I've found it unnecessary. In the next window, they ask you if you're sure you want to reconfigure. Choose yes. In the next screen you can choose fcitx as your input method.

Log out and log back in. When you do, there will be a little keyboard on the bottom task bar. Right click and choose configure input method. Click the plus sign at lower left. Uncheck the box that reads only show current language. The box below it is the search box, type mozc in there. In the top textbox, you should now see mozc Japanese, and, once you highlight it, you should be able to click the OK button. Do it and close the window.

You should now be able to switch between English and Japanese with the ctl+space keyboard combination.

To do this with Ubuntu, using Unity, it's almost the same. The keyboard icon will be on the upper right taskbar instead of the bottom right, and I think the menu says Configure current input method instead of Configure input method, but otherwise, the steps are the same.

Lubuntu 16.04 is a bit different. Go to Preferences and choose Language Support. Add Japanese, which should install fcitx-mozc. Make sure that it has, otherwise, install it with apt-get install fcitx-mozc.

Also in the language settings box, there should be a keyboard input method section. Make sure it says fcitx--it may say none by default.

Log out, log back in, you'll see the keyboard icon. Click the Configure Current Input Method.

Typing mozc in the search box gave me no results. After unchecking Only Show Current Language, I had to scroll down to Japanese. This had a little arrow to the left. Clicking that arrow showed me mozc. I then highlighted it with the mouse, and now had to click a rightwards pointing arrow to put it in the right hand pane with a header of Current Input Method, under English, which was already there. There was no way to close the Input configuration window so I closed it with alt+F4. I could then input Japanese with ctl+space.

With Ubuntu Unity 16.04, when I first opened settings to add and remove a language, ibus was shown as the default. I chose to add Japanese, and that automatically installed fcitx-mozc. When it was completed, I closed the language window and reopened it. This time, fcitx was available as an option.

Log out, log in, and there is a small keyboard icon on the upper right. Click it, once again choose configure input method, uncheck the option to show current language, type in mozc, which should show up. Click Ok and you should be able to use Japanese in most applications by hitting ctl+space.

With Lubuntu 15.10, once Japanese was set up, I could use another window manager such as dwm and easily change between English and Japanese with ctl+space. I haven't checked with 16.04

For those who want to use fcitx-mozc in 12.04, there is an unstable ppa at To add it, run
sudo add-apt-repository ppa:fcitx-team/nightly

You can then run apt-get update;apt-get install mozc-fcitx im-config. From there, the instructions are the same as they were for Lubuntu above. Run im-config, choose fcitx, Log out, log back in, click the little keyboard, choose configure input method, uncheck show current language, type mozc in the search box, and when it appears up top, click OK. In a very quick test, it worked in LX terminal, Chrome and Abiword.

I repeat that it is an unstable ppa, so use at your own risk. The stable ppa doesn't have the fcitx-mozc or fcitx-anthy package.

Lubuntu 17.04 and 17.10 are very much like 16.04. Go to preferences, choose language support. You may get a notice that language support is not completely installed, click remind me later.

Click install / remove languages. Select Japanese, click apply, and put in your password. Once it's instsalled, the first window that showed up is still open and has a drop down box for keyboard input, choose fcitx.

Selecting Japanese should install fcitx-mozc, you can always check with a terminal command dpkg -l |grep fcitx-mozc. It should list it with ii in front of it, meaning it's installed. (If not install it with apt-get install fcitx-mozc).

Log out and log back in. You will now see a keyboard icon to the lower right. Click it and it should give you the option to Configure Current Input Method. Click that and a window opens. Uncheck Only Show Current Language.

In the list of languages that appear, click on Japanese and a little arrow will appear to its left. (Or said arrow may already be there). Click it and one of the choices will be Mozc. Highlight and click the arrow to the right which should put Mozc into the right hand pane of the window.

Close the window and you should be able to input Japanese, toggling between Japanese and English with ctl+space.

There are almost always updated tutorials on using Japanese in Ubuntu on the Ubuntu Forums and the reader can always look for the latest tutorials there.

Ubuntu-17.10 has gone back to Gnome which uses ibus by default. If one googles ubuntu-17.10 ibus you'll see some complaints about this, but, like other distros using Gnome, one can use fcitx if they wish. These instructions have been tested as late as Ubuntu-21.10

Note that like RH and Fedora, it may be easier to use ibus. In that case add the language as mentioned above and run ibus-setup. You should be able to take defaults. Sometimes I've found that I have to restart to get it all working, but in the end, if you leave it at defaults the super (Windows) key and space will change input method from English to Japanese. You may have to click the letter icon on the top right once or twice to change back and forth, but after that it's just worked for me, as long as I use Gnome.

Even with Ubuntu, I tend to prefer alternative desktops and fcitx works across a wider range of them for me. So, assuming you want to use fcitx the following should work.

Disassociate it as we do in Fedora.
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"

Install fcitx-mozc with apt-get install fcitx-mozc. Now, run im-config. This opens a dialog, with the first page showing the possible choices and showing ibus as the default. Click Ok. The next page asks if you explicitly select the user configuration, recommending a choice of no, but choose yes. The next page lists several choices, including fcitx. Click the radio button to its left. The next page lists the choice, saying to restart X. I've found it simplest to just reboot. as otherwise, the change didn't seem to stick.

Run fcitx-configtool. Click the plus to add a language, uncheck the only show current language and type mozc in the search box at bottom. It should appear at top. Highlight it, click OK and another box should show, showing mozc. Close the box. You should now be able to input Japanese.


Linux Mint

(Last update December 2020)

With Mint's Rebecca, once logged in, in the start menu search for languages. Click the Install Remove Languages button and choose Japanese, Japan UTF-8. (You'll be asked for your sudo password once or twice during this)

Japanese will then show as an installed language, but show that some language packs are missing. Click on it and you'll have the option to install them. Once it is showing as fully installed in the list of installed languages window, when you close that window, you'll see a window for input methods in 17.1.

Choose fcitx. Once it's installed you can ignore the button for optional components, but use apt-get to install fcitx-mozc from a terminal. You'll also remove fcitx-qimpanel, otherwise, when we get to the input icon, it will be in Chinese. After doing this, if you go back to the input manager menu for any reason, it will show that fcitx has a missing component. This refers to the qimpanel and can be ignored. If you're using XFCE, it may not be necessary to remove qimpanel, as when I tried this with its XFCE edition, the icon gave me an English menu.
sudo apt-get install fcitx-mozc
sudo apt-get remove fcitx-ui-qimpanel

Once this is installed, log out and log back in. In the lower right, you will a little keyboard icon. If you right click it, you will see a menu. In Mint's case, you can either use Config or Configure Current Input Method, it will open the same menu.

From here, it's just like Lubuntu and Ubuntu. Click the plus sign at lower left. Uncheck the box to only show current languages and type mozc in the search box. When it appears in the upper box, highlight it and click OK. Close the dialog box and you should now, in any application that accepts Japanese input, be able to hit ctl+space and you'll see a little box that says mozc. You will then be able to input Japanese.

With the XFCE edition, I installed fcitx-mozc, then restarted fcitx. When I went to configure current input method, mozc was already there.

17.2 was slightly different. I've only worked with Cinnamon. After installing Japanese and its language packs, one just clicks a different tab to get to input methods and install fcitx. Then install fcitx-mozc with apt-get install fcitx-mozc. Log out and log back in.

17.3 went back to closing the add languages window and seeing a window for input methods.

My results haven't been consistent. Sometimes, there was no qimpanel icon, other times there was. So, do the apt-get install fcitx-mozc, apt-get remove fcitx-ui-qimpanel, log out and see if there's a keyboard icon on the lower right.

If there is, do it the way we've done it in 17.1, if not, open a terminal and run

This opens up that same dialog box that has been mentioned, for input method configuration. As we have in each case, click the plus sign at lower left, uncheck the box to only show current language, type mozc in the search box and when it appears in the top box, highlight it and click Ok. You should now be able to hit ctl+space and input Japanese.

In at least one test install, I didn't even have to do this. I installed fcitx, logged out, logged back in to see no qimpanel, then installed fcitx-mozc. Upon installation, without running the config tool, as soon as it was installed I was able to input Japanese. I don't use Mint enough to keep testing, but to sum up, if, after installation, the little keyboard icon doesn't appear, you may be able to input Japanese as soon as you install fcitx-mozc. If not, then you can run the fcitx-configtool command and be able to add mozc, then use it.

I've also found that if I want to use dwm in Mint for whatever reason, the easiest way to get it working with fcitx is to create a $HOME/.xsession file reading
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
fcitx -d -r 
exec dwm 

and then in 17.1, choose, from the login choices, the Run XClient Script option. Judging from many posts on Mint Forums, few Mint users realize what that does--it looks for a $HOME/.xsession, so is one easy way to add custom window managers. The other way is to go into /usr/share/xsessions, copy one of the existing *.desktop files to say, dwm.desktop and substituting your window manager for the one in the file you copied. However, again using dwm as my example, though this would start dwm, it wouldn't start fcitx or use the variables that I'd set. Therefore, I used the Run Xclient script with the $HOME/.xsession mentioned above.

The Run Xclient script is gone from 17.2. One can still create a $HOME/.xsession, and then create a /usr/share/xsession/dwm.destop pointing the Exec line to your $HOME/.xsession. You will, if doing this, have to make the $HOME/.xsession executable with chmod 755 $HOME/.xsession. You can do that in 17.1 too, of course, but it's less typing to just create the $HOME/.xsession and use Run Xclient

The /usr/share/xsessions/dwm.desktop should read (if your user name was john
[Desktop Entry]
Comment=use dwm

There's an Icon line that you can leave blank or remove.

With openbox, it would start fcitx but not use the variables. I just copied my $HOME/.xsession to $HOME/.xsessionobox, and changed the exec dwm to exex openbox-session. I then edited the /usr/share/xsession/openbox.desktop that had been created when I installed openbox. By default it reads

[Desktop Entry]
Comment=Log in using the Openbox window manager (without a session manager)

I changed the Exec line to read

I then changed the permissions on my $HOME/.xsessionobox to 755 and then, if I chose openbox, it would have the proper variables set.

Most of this also worked for Ulysa. I used the xfce4 version, installed openbox and did this in an openbox session. I created an .xsessionobox, then set /usr/share/xsession/openbox.desktop to use /home/scottro/.xsessionobox.

Also, with Ulysa, after installing fcitx-mozc, I had to log out and log back in for fcitx-configtool to find mozc. (Also, fcitx has to be running, I just did that from command line, running fcitx -r -d).

However, on one install of Ulysa, on my yoga2, to get openbox to read the environment variables, adding them to $HOME/.xsessionobox didn't work. I had to add them to /etc/X11/openbox/environment. Once I put the XMODIFIERS and other variables in that file (you need to do it using sudo), openbox used them.

If you'd rather not do something like that and just need the variables set when you run particular programs, use a script similar to the ones mentioned above. Calling it something like put it in $HOME/bin directory, and have it read
XMODIFIERS=@im=fcitx GTK_IM_MODULE=fcitx QT_IM_MODULE=fcit ${1+"$@"} &
and call whatever needed with it, e.g., firefox or gnome-terminal. The reader can use what method works for them, but, at least judging from Mint forums and conversations with friends and co-workers who use Mint, most of them stick with the default desktop.

One other oddity with 17.2 Rafaela and openbox. The openbox menu opens gnome-terminal with a black background and black foreground so that it's not readable. This can be fixed by right clicking inside the terminal, going to Profiles, Profile Preferences and clicking the Colors tab.

With LinuxMint 18, Sarah, there are few changes. In the Mate version, I typed Language into the menu search bar, and opened Language Settings. I clicked Install/Remove Languages. Click the Add button and choose Japanese,Japan UTF-8. Click install. Close the Add language window and you should see Japanese is now installed, albeit with a message that some language packs are missing.

Closing that window goes back to the Language Settings window. Click the Input Method tab. You will see Fcitx with a line underneath saying not installed. Click the Add Support for Fcitx button.

There's an option to install the additional components, but that seemed to have a lot that I didn't want. So, I then opened a terminal and ran
sudo apt-get install mozc

I then logged out, and logged back in. (That may not be necessary). I now did a search for fcitx in the menu and had an option to start the input method. When I did that, a keyboard icon appeared in the lower right. Right clicking that gives an option to configure current input method. Click the plus sign and unclick the Only Show Current Language checkbox. Type in mozc, it should appear at the top, and click OK. At this point, you should be able to input Japanese with the usual ctl+space trigger.

. I didn't check how to make it automatically start at each log in. Instead, if I needed to use it, I would just type fcitx in the menu search and click the start fcitx button.

Mint 18.2, Sonya, using Cinnamon is almost the same.

  1. Type language into the menu search bar and click Languages.
  2. Put in password when requested.
  3. Click the add button at the bottom left of the window that opens.
  4. Choose Japanese_Japan UTF-8. Click Install. It now appears in languages.
  5. Close that window. Click the Input Method on the window that you now see. Click the install button on Japanese.
  6. Enter password and it will show that it's downloading. When done, it will show installed with a note to choose Fcitx or ibus.
  7. In the top section, click the dropdown box next to input method and choose fcitx.
  8. Close the window (there's no save or OK button.) Log out and log in.
  9. You will now see a new icon on the lower right, a penguin. If you click it, it may turn into a keyboard. Open a terminal and type in

  10. Click the plus sign at lower left. Uncheck the box that says Only Show Current Languages.
  11. Type mozc in the search box and it should show up at the top. Click Ok, and close the dialog window
You should now be able to toggle between Japanese and English with ctl+space.

The instructions for Sonya also work for 18.3, Sylvia, Mate edition. (I think one of the input buttons was named differently.)


Debian Jessie and Stretch

(Last updated July, 2017) Once you have X working, install fcitx-mozc. If you have your install set to not install recommended packages, unset that. (For example, I have that set in /etc/apt/apt.conf, so before installing fcitx-mozc, I comment that line out.) It will pull in quite a few packages, but I've never figured out what is and isn't necessary.

Also install dbus-x11 if it's not installed.

I add to my $HOME/.bashrc file
export LC_CTYPE=en_US.UTF-8

I also insert the following in my $HOME/.xinitrc, before the line calling my window manager (usually dwm or openbox)
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx 

If you boot into a GUI, I'm not sure where that would go. It can always go into your .bashrc, but it's better to put it into a file read when X starts, which may depend upon your window manager. Some window managers, such as openbox, will automatically start fcitx when you run startx. If you don't want this, you can look in /etc/xdg/autostart and rename the file. If you're running a different window manager such as dwm, that doesn't automatically start it, and want it to start whenever you start X, you can have fcitx start whenever you startx by putting, also above the line calling your window manager
fcitx -d -r

into your .xinitrc.

The -d as mentioned makes it a background daemon, the -r restarts it if it was already running.

We need fonts, This is what I use. The reader of course, can use others.
apt-get install ttf-kochi-gothic.

Now you should be able to run fcitx-configtool. It opens up a dialog box (like Fedora, and also basically what you see when you click the config menu in Ubuntu or Mint). Click the plus sign at lower left to add a language. Uncheck the box to only show current language and type mozc in the search box. It should appear in the upper dialog box. When it does, click Ok, and you're returned to the main dialog window. Close it. I haven't noticed a close menu, I just close it with alt+F4 in openbox--use your window manager to close the dialog window. Now, if you hit ctl+space in any application that accepts Japanese input, you should see a little box saying mozc.

This can also be done manually with the following method. Once you've started X, run fcitx with no arguments for a moment. Then you can kill it with ctl+c. This will create (if it wasn't already there) a $HOME/.config directory which will now contain an fcitx subdirectory. Kill X and while in console edit $HOME/.config/fcitx/profile. It has very long lines, and may show as 10-20 lines and a bunch of @ symbols. Do a search with your editor's search function for mozc. You'll see it says mozc:False. Change that False to True. Now startx and make sure that it still says True. (It should as long as you killed X before editing the file. Killing fcitx doesn't seem to be enough.) Now, if you haven't started fcitx in your .xinitrc file, you can manually start it with fcitx -r -d. Once back at a command prompt, hitting ctl+space should give you a little box saying mozc and you should be able to input Japanese.

Debian-9, Stretch, is similar. Instead of kochi fonts which didn't seem to be available, I let fcitx-mozc pull in some fonts, such as vlgothic. Make sure dbus-x11 is installed before starting X, and start fcitx -d -r before running fcitx-configtool. Otherwise the instructions are the same as they are for Jessie.


MXLinux Fluxbox edition

(Last update July 2023)

First, once you're an X session, install fcitx-mozc. Root privilege is required, in the example, I'm using sudo.
sudo apt install fcitx-mozc

Next, click on the Software icon on the desktop. (A downward pointing arrow and plus sign). It will ask for your sudo password. From the menu that appears once you've authorized, click the arrow next to languages, which opens a whole list of language related packages. It's in alphbetical order, so scroll down to Japanese. I selected everything for Japanese, the packages are for Japanese Firefox, Fonts, Input, Input_fcitx, Libreoffice, and Thunderbird. Click install and let MXLinux install the packages.

I then added the usual variables to my $HOME/.fluxbox/startup since it uses lightdm to boot, and it wouldn't read what I put in .xinitrc. So, in $HOME/.fluxbox/startup I have
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export LC_CTYPE=en_US.UTF-8

If you really want to add those lines to .xinitrc instead, and boot into text mode you can manually edit /etc/inittab. By default, MXLinux uses SysVinit and you can change the id:5:initdefault line in /etc/initab to

Then MXLinux will boot into text mode, you can run startx and it will read .xinitrc, enabling Japanese in applications. But most people will probably prefer editing $HOME/.fluxbox/startup.


Then, I started fcitx from the drun menu that appears when you hit the Mod4 (usually Windows key on a PC keyboard), and I could input Japanese. I didn't even need fcitx -d -r, just fcitx worked. If it doesn't work for you, then try it with fcitx -d -r


(Last update December 2017)

ArchLinux has packages for fcitx-mozc. To get it working with various applications, I also installed fcitx-gtk2 and fcitx-gtk3. The wiki article mentions installing fcitx-im and choosing all, which will install fcitx-gtk2, gt3, and qt4 but I didn't need it for the apps I used, urxvt, firefox, google-chrome-stable, and libreoffice.

Install with pacman
pacman -S fcitx-mozc fcitx-gtk2 fcitx-gtk3 fcitx-configtool

Install fonts. I use sazanami.
Pacman -S ttf-sazanami

Once installed, setup is similar to the Fedora or Debian setup. Run fcitx-configtool and it will open a window to add input methods. Click the plus sign at lower left, then uncheck the box to only show current language. Type mozc in the search box. It should show up, then hit OK.

Now if you hit ctl+space, you should be able to enter Japanese in any app that accepts it.

Like Fedora and Debian, this can also be done manually. Start X then start fcitx. Then kill X. This should create a $HOME/.config/fcitx directory. In there you will find a file called profile. Open it with your favorite text editor (while not in X). You will probably see about 10 lines and several @ symbols, use your text editor's search function to find mozc. You will see mozc:False, change that to read mozc:True.

Set the XMODIFIERS and various IM_MODULE variables in in .xinitrc, before the line calling your window manager. For example, if using dwm
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
exec dwm
If you will always be using it, you can also start it in your .xinitrc file.
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
fcitx -d -r 
exec dwm

The -d starts it in the background and the -r just restarts it if a desktop environment had already been running it.

If only using it on occasion, then start it from a terminal, dmenu or whatever you use, with fcitx -d -r.

If you look at your $HOME/.config/fcitx file once X is running and fcitx has been started, you'll see that a line that previously read #IMName= will now say IMName=mozc. However, editing that line makes no difference, it's the mozc:False that has to changed.

Once you've started X, applications that accept Japanese input will work once you hit ctl+space. If gtk apps aren't working, make sure you remembered to install fcitx-gtk2 and fcitx-gtk3. You can also, even if you forgot to install them, sometimes get them working by changing the GTK_IM_MODULE=fcitx to GTK_IM_MODULE=xim, but installing the fcitx-gtk2 and gtk3 package is easier.

If you find that you can enter the characters, but, especially in urxvt, nothing but a blank space shows up, make sure that you actually did generate a UTF-8 locale, such as en_US.UTF-8. The one or two times it happened to me, I'd skipped the step in the Arch installation guide of uncommenting a locale in /etc/locale.gen and then running locale-gen.

One hint that this is the problem is, in one terminal, while fcitx is running, open a second terminal. If you see a message similar to default locale unavailable, and/or unable to create fontset for input method, then the chances are good that you should repeat the steps you should have taken during installation to generate your locale. Or, as has happened to me, check that you didn't make a typo in /etc/locale.gen.



(Last update March 2018)

As of early March, 2018, VoidLinux has both fcitx-mozc and fcitx-anthy. We'll cover fcitx-mozc.

It can be installed with xbps-install -S fcitx-mozc. You need dbus, which, if you're running X, you've probably already installed and set to run at boot, but if not
xbps-install -S dbus
ln -s /etc/sv/dbus /var/service/

You will also need a font. I use ipafont-fonts-otf.

It is also necessary to install libfcitx-gtk and libfcitx-gtk3 to get gtk apps to work.

Put the usual variables in .xinitrc or .bashrc
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export LC_CTYPE=en_US.UTF-8

The VoidLinux version doesn't seem to have the fcitx-config package so I configured it manually. Start X, run fcitx -r and then stop X. You should now have a $HOME/.config/fcitx/profile file. If the file doesn't list a bunch of input managers with False after their name, you may have to startx and run fcitx -d once more. At any rate, search for mozc in the long list, change the False after its name to True, and once again run startx. You should now, if you hit ctl+space, be able to input Japanese in most applications. (Many thanks to the Void developers who responded to the request for this package and did the work.)

If there is still trouble with GTK apps, run
sudo gtk-query-immodules-2.0 --update-cache
sudo gtk-query-immodules-3.0 --update-cache

As mentioned elsewhere on this page, you can probably get it to work by changing GTK_IM_MODULE=xim, but the gtk-query-immodules method seems easier to me. As mentioned in the section on Arch, if Japanese is working everywhere but the terminal, there's a good chance you never set, or made an error setting, locale during installation. They have a page on setting or modifying locales, so make sure you do have your locale set properly. The symptoms are similar to Archlinux mentioned above, if you have a terminal open and fcitx running, then, in that terminal type urxvt (or your terminal of choice) and get a message that the default locale is unavailable and/or that it's unabled to create the fontset for input method, doublecheck that your locale is set. For me, I just use en_US.UTF-8, I don't need to set a ja_JP locale for Japanese input to work correctly.



(Last update December, 2020) FreeBSD-10 and up has fcitx-mozc. FreeBSD-9.3 uses fcitx-anthy. We'll cover mozc, but the steps for anthy would be the same, though I haven't tried in awhile.

Install it with portmaster.
portmaster japanese/fcitx-mozc

With pkg it would be
pkg install ja-fcitx-mozc

I install various fonts--the reader can choose their own, I usually install font-sazanami, font-kochi, font-vlgothic (all in /usr/ports/japanese) and x11-fonts/hanazono-fonts-ttf.

If using pkg it's pkg install ja-font-sazanami, ja-font-kochi ja-font-vlgothic hanazono-fonts-ttf. The noto fonts are also popular.
pkg install noto-jp

There are several other packages that use noto fonts, such as noto-emoji. Running pkg search noto will show what is available.

For those who use libreoffice, it is probably also necessary to install fcitx-qt5. This has also not been consistent for me, at times, it seems something else will pull it in, other times, I've had to specifically install it.

Another oddity, is that on some installs, urxvt wouldn't show Japanese. It didn't give anything. I could hit ctl+space, characters would appear, but when I hit enter, the terminal stayed blank. I then reinstalled from ports (I'd installed with pkg the first time), it added in a few packages from Chinese, and then everything was fine. However, on another install from pkg, that definitely didn't have these Chinese packages installed, I didn't have that problem. I only mention it in case the reader has a similar issue--if urxvt isn't displaying Japanese, try reinstalling it from ports. If that still doesn't work, the other issue I've found is that it may not work if LC_CTYPE isn't specified. So, on some installs, I have had to insert

export LC_CTYPE=en_US.UTF-8

to $HOME/.xinitrc, above the line calling the window manager.

The message after installation, readable with pkg info -D -x fcitx-mozc, tells you to add variables and commands to start fcitx and mozc to your .xinitrc file (or .xession, if you use that.) It suggests adding
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=xim
export XMODIFIERS=@im=fcitx
/usr/local/bin/mozc start
fcitx -r -d

In practice, I find that I don't need the mozc line. I also add, as mentioned above
export LC_CTYPE=en_US.UTF-8

Also, make sure that your window manager or desktop environment isn't using ctl+space for anything, as that is fcitx's default key combo to switch between Japanese and English. I've never tried to change it, but I believe you can do so in $HOME/.config/fcitx/conf.

There is a separate port, chinese/fcitx-configtool. Install it with portmaster chinese/fcitx-configtool. Once it's installed run it.

On the left it will show available input. Uncheck Only Show Current Language at the bottom. Once you do that, you'll see a bunch of languages in the left hand window. Click the little arrow to the left of Japanese. and at the bottom of the list that appears, you should see Mozc. Highlight it and then click the arrow pointing to the right window, and it should now appear under whatever language you're using. Hitting ctl+space should now allow you to input Japanese in applications that accept it.

This can also be done manually. After starting fcitx the first time, you will have a $HOME/.config/fcitx/profile file. Kill X and then edit it. If using vi, as it has extremely long lines, you may just see about 10-20 lines then a bunch of @ symbols, but if you search with your text editor's search function, you'll find

This has to be changed to read mozc:True. Once this is done, you should be able to hit ctl+space in any application that will accept Japanese input, see a little box saying mozc, and be able to input Japanese.

As mentioned, it has sometimes changed my keyboard map, so, in my .xinitrc on FreeBSD, I start with a line to set my keyboard to us. Therefore, my $HOME/.xinitrc reads
setxkbmap us
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=xim
export XMODIFIERS=@im=fcitx
fcitx -r -d
exec dwm 

This doesn't always work for me, but if not, I can always run setxkbmap us once I've started X which will fix any issues. I haven't run into this issue in several months, so it may have been a one time glitch.

In FreeBSD-10 and 11.x, I've sometimes had another oddity. The fcitx-mozc worked in everything but Firefox, including other gtk apps like Thunderbird and Libreoffice. I have in my .xinitrc
export LC_CTYPE=en_US.UTF-8

However to get Japanese working in Firefox I had to run
LC_CTYPE=ja_JP.UTF-8 firefox

and then Japanese input worked.

Another possible solution--the problem hasn't occurred in many months so I can't check, but this has sometimes fixed such an issue on Linux--is to change the export GTK_IM_MODULE=fcitx to export GTK_IM_MODULE=xim. If the problem occurs again, I'll update.

Although I'm no longer using ibus-mozc in FreeBSD, I'm leaving in this next part because it was a lot of work. (The work involved is one of the reasons I've switched to fcitx. I've found similar issues in Fedora)

In FreeBSD-10, with openbox, fluxbox, dwm, and spectrwm, it was more difficult to get ibus-mozc working as I wish. It seems to ignore the keyboard shortcut I use in ibus-setup. I usually use ctl+space, but I had the same problem regardless of keys chosen.

In openbox, I use tint2 as taskbar, which is how I discovered the following workaround. In tint2, upon startup, one sees an icon for input method. It says (in my case) US by default. Clicking on it, I was able to change to mozc. I then see a submenu that is at direct input by default. If I click that to use hiragana as the input method, everything works. This may have to be done with every log in. Some very casual testing indicated that the icon would stay at mozc, but that I would manually have to set input to hiragana every time between X sessions and that it reset to US between reboots.

Once this has been done, (at least for the particular X session), one is able to use whatever hotkeys they chose in ibus-setup, ctl+space in my case.

To get it working properly in dwm or spectrwm, where I don't use tint2, I have found that although it's a bit kludgy, the easiest way to get it working will be to briefly open up tint2.

If you don't have a $HOME/.config/tint2/tint2rc it will fail to start. You can copy that over from /usr/share/examples/tint2. (The .config/tint2 directory will be created the first time you try to run tint but the it's quicker to prepare).
mkdir ~/.config/tint2
cp /usr/local/share/examples/tint2/tint2rc ~/.config/tint2

As previously mentioned, the tint2 bar will show a language icon. If you click it to get to mozc, there will be a submenu to choose input. Choose hiragana, and it should work on applications that support Japanese input. On FreeBSD-10.x, I could use it in gnome-terminal, but it took a reboot to get it working in urxvt. Once it starts working in say, dwm, where I don't normally want tint2, I can close tint2 and it will continue to work with my ibus hot-keys of ctl+space to switch back and forth between input methods.

This works with every test I've made with a single monitor. Prior to stumbling upon this solution, user byuu on FreeBSD forums, wrote a little script to get it working. See this thread on the forums for extra details. The script mentioned below is from byuu.

This script is the only way I've been able to use multiple monitors without making every change to input by mouseclick.

When doing so, I can ignore the ibus hot keys in ibus setup. Instead create hotkeys, through the window-manager, to a script that does the change. Here is what I did with openbox. Although instructions in the ibus pkg-message suggest adding a few more things to one's .bashrc (or other shell rc file), I've only needed the following.
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export LC_CTYPE=en_US.UTF-8

Next, create a small shell script. I put it in $HOME/bin, the script can go anywhere in your shell's $PATH. (If that doesn't mean anything to you, don't worry about it. Make a directory in your home directory, called bin, if it doesn't already exist, and put the script in there.) In this case, I'm using mozc. If you prefer to use anthy, just substitute anthy for mozc-jp in the script.
if [ `ibus engine` = 'mozc-jp' ]; then
  ibus engine xkb:us::eng
ibus engine mozc-jp  #or whatever IME you prefer; change it above too.

Note that those are backticks around ibus engine, not single quotes.

Name it somehing like, and make it executable.
chmod 755 ~/bin/

Now, in ibus-setup, the default is super+space. As testing has indicated that regardless of what I've set for the hotkey to switch input, it gets ignored, you can leave it at that, the script is going to perform the function of switching input methods. Lastly, in openbox, I added a stanza to link ctl+space to the script. My $HOME/.config/openbox/rc.xml file contains
<keybind key="C=space">
<action name="Execute">

Now, using ctl+space will switch between English and Japanese.

in DWM, I made a different keyboard shortcut to the script, having nothing to do with either super+space or control+space. The little script takes over and does the switching. In openbox, through xdg, ibus is started when one runs startx. In dwm, I would manually start ibus with
ibus-daemon --xim &

Once ibus is started, the default input is Japanese. So make sure you can get to your script to switch back to English, otherwise, you'll be unable to type commands. If you have a keyboard shortcut to dmenu, that will work, as dmenu, at least in my tests, would use English input--therefore, if I was in dwm and couldn't input English, I was able to use a keyboard shortcut to open dmenu, and type in as a command, At that point, I was again able to input English.

For setting up keyboard shortcuts in dwm, see my page on it, which has also has links to more involved tutorials. In short, one creates their own config.h, then installs by doing a cd /usr/ports/x11-wm/dwm and using the path to said custom config.h. For example, if I put my custom config.h in /home/scott, I would use
make DWM_CONF=/home/scott/config.h install clean

With portmaster, it's
portmaster -m "DWM_CONFIG=/home/scottro/config.h" x11-wm/dwm

In that custom config.h I have two lines in their respective places The first line defines the command.
static const char *imswitchcmd[] = {"", NULL };

The second line will be in the keyboard bindings. In this case, I chose to use my modkey for dwm, which I've defined elsewhere to be mod4, and y, in part because it's easy to reach while typing and hadn't been used for anything else. So, the other line to reach the script is
{ MODKEY,		XK_y, spawn,     {.v = imswitchcmd } },

(If this isn't clear, it's suggested that the reader check the dwm link given above.)

To sum up, if the tint2 method isn't working for you, create the script and set up a keyboard shortcut for it, then, using that keyboard shortcut, you should be able to easily switch between English and Japanese. If, for some reason, you can't set up a keyboard shortcut, then set up one for dmenu, because if you can open that, it will use English rather than Japanese, for input, so even you're temporarily unable to get English input, you can run your from demenu, which will bring you back to English.

As mentioned, I needed this with multiple monitors. Even so, I had to initiate the im switching by clicking the icon on the taskbar--tint2 in openbox, and trayer in dwm. (In dwm, tint2, when used with multiple monitors, doesn't show an icon for ibus.)

It's a kludge, but once I've clicked the icon once and changed from mozc's direct input to hiragana, it works pretty smoothly. In openbox, I leave tint2 open anyway, in dwm, I can close trayer once I've gotten started.

These were the only two that I spent time testing. In fluxbox and spectrwm, there was an icon on the taskbar (with spectrwm, I used tint2) but I could only manipulate it with mouseclicks. Anyway, with multiple monitors, I found it necessary to use byuu's script.

In summary, I think it's far easier to get it working with fcitx, especially with multiple monitors, where, unlike ibus, it had no trouble. The only issue with fcitx is that one has to, after starting fcitx, stop it and manually change that mozc:False entry to True.

I haven't investigated it very thoroughly, as I don't need it that often, so I'm not sure if there are very simple fixes to these issues, but I think the user is better off with fcitx.



(Last update April, 2022)
OpenBSD didn't get fcitx-anthy until the snapshots following version 6.2. Prior to that,they used ibus. For -current, or any snapshots following the release of 6.2, fcitx-anthy is available, and is in 6.3 and later.

To use ibus, first I installed ibus-anthy and ja-sazanami-ttf fonts. (I only needed the fonts for libreoffice--in firefox and the urxvt terminal, whatever ibus-anthy pulled in was sufficient.)

I ran ibus-setup, choosing ctl+space as my hotkey to alternate input. As OpenBSD's default shell is ksh, I then added the usual lines to my $HOME/.profile.
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export LC_CTYPE=en_US.UTF-8

I would then start ibus manually with
ibus-daemon --xim &

This allowed me to input Japanese but I wasn't able to switch to English.

After my earlier success with FreeBSD and tint2, I installed tint2 (pkg_add tint) and clicked the icon. There was an Anthy preferences submenu . It showed that the default to switch between hirangana and Latin was was ctl+j. I started using that and could easily switch back and forth between Japanese and English input. I tried changing its default to my preferred ctl+space, but either it didn't work or I missed something, so I went back to its default of ctl+j. This allowed me to input Japanese in the few things I checked, urxvt, libreoffice, and firefox.

As of 6.3, fcitx-anthy is available.
pkg_add fcitx-anthy ja-sazanami-ttf fcitx-gtk3

There is, in 7.1, also fcitx-kkc but that didn't work for me. The fcitx-gtk3 is necessary for firefox, otherwise, you have to call it with LC_CTYPE=ja_JP.UTF-8 firefox and gnome-terminal won't work at all. Actually, in at least one test I did, changing GTK_IM_MODULE=fcitx to =xim made it work without having to specify an LC_CTYPE, so your mileage may vary. Installing the fcix-gtk3 package seems the easiest way to get it working as expected.

When done, startx, run fcitx -d and then quit X. Edit $HOME/.config/fcitx/profile, looking for anthy:False and change it to anthy:True and startx again.

OpenBSD now uses the xenodm display manager so I couldn't easily drop out of X, edit .config/fcitx/profile and restart X. Instead, I edited the profile, changing anthy:False, to Anthy:True and tried just closing openbox, my usual window manager and logging in again. I got different results with different VirtualBox installs. In one case, that worked, and I could then input Japanese, in another case, I had to reboot before the changes showed up in profile.

You may also need to add the XMODIDFIERS=@im-fcitx, etc., to .xsession which is preferred to .xinitc with OpenBSD.

This has changed slightly in OpenBSD-7.2 I added fcitx-anthy, which also installed fcitx5. You can't run fcitx -d, you have to run fcitx5 -d. Also, I didn't seem to be able to manually add anthy as an input method in ./config/profile. Instead I had to install fcitx-configtool-qt-5. Once installed, I could call it with fcitx-configtool and it would open up the typical fcitx-config dialog. I just typed anthy in the search box, it came up, and I clicked the arrow that points to the left to add it to input methods.

While OpenBSD's vi doesn't seem to accept Japanese input--the letters show up but when you hit enter, you get a series of characters like (if I type Nihon in Japanese) \xe6\x97\xa5\xe6 and so on, you can, in a urxvt terminal, do something like echo "some Japanese text" > to a file. I didn't investigate very thoroughly as both the vim-gtk2 and the nvi editor, both available as packages, allowed me to input Japanese in a text file.



(Last update February, 2018)
DragonFly has fcitx-anthy available in packages and ports. One can install from package. We'll need a font, I use sazanami.
pkg install ja-fcitx-anthy ja-font-sazanami

I add the following to ~/.xinitrc, above the line calling the window manager. It can also go in whatever profile file you use, depending upon your shell.
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export LC_CTYPE=en_US.UTF-8

You will need to have dbus installed and running, so add dbus_enable="YES" to /etc/rc.conf and start it with service dbus start

Startx, start fcitx with fcitx -d. Kill X and you should now have a ~/.config/fcitx directory with a profile file. Edit profile and change anthy:False to anthy:True. Startx again, start fcitx and you should be able to input Japanese.


Using Putty from Windows

Much of this was taken from this page from

If you are using Putty to open an ssh session, you can still view Japanese encodings. On the Windows machine, you will have to install Asian Language Support. (Control Panel, Regional Settings or Regional and Language Settings.) You will probably need the Windows installation CD for this. You should also choose the option to Install files for complex script and right to left languages. (The link given above has several screenshots.). Windows will suggest you reboot after installation. Do so.

Open your putty session, right click on the title bar, and choose Change Settings from from the menu.
Go to Window, Appearance. Click the Change button in the Font settings section.
Choose MS Gothic or MS Mincho and Japanese as the script.
Go to the Translation section. In the dropdown box at top, choose UTF-8. Also check the box that says Treat ambiguous CJK characters as wide.

Once this is done, you should be able to view Japanese text in a putty ssh session from a Windows machine.



(Last update December, 2017)
Several applications will translate a file to postscript level 2 (or possibly higher). Acroread, xpdf, libreOffice, firefox, and many others will all do this. With such applications, assuming you can already print from them, no further work is necessary and Japanese will print out as written.

To print Japanese one needs fonts. If you have a text document, say in vi (like a mutt email) you can open it in firefox or libreoffice and print it. or use the libreoffice -p option.
libreoffice -p nihongo.txt

This should use libreoffice's postscript converter to create a printable document. Another option is to convert it to pdf with the libreoffice convert-to option.
libreoffice convert-to pdf nihongo.txt

Firefox also allows you to choose to print a document to pdf.

This will produce a pdf document that can then be printed.

There is also paps, which converts text to postscript.
paps --paper=letter nihon.txt|lp

In cases, it seems cups itself will do the postscript conversion. I haven't tried in awhile, but the user can try printing the textfile directly through cups.



While only indirectly related, there are times when when one wishes to use special characters when typing romaji. When writing for people studying Japanese, my own tendency is to imitate hiragana, and write, for example, juudou for the martial art. However, for people with no knowledge of the language, this can be somewhat confusing. Most systems that have locales will also have a Compose file for that locale. For example, in FreeBSD, there is a file /usr/local/lib/X11/locale/en_US.UTF-8/Compose. It will probably be elsewhere on a Linux system. That file will have several entries for special characters. Mine has things like
<Multi_key> <underscore> <a>  : "ā"   U0101 # LATIN SMALL

(If that didn't look like a small letter a with a line over it, then your browser is probably using a different encoding. Go to View=>Encodings and choose UTF-8 and you should see (among other things) a lower case "a" with a line over it.)

This means that if I use the Multi or Compose key, then hit underscore, then a, I will get an a with a line over it. The problem is setting the compose key.

This can be done globally (for all users) by making an entry in /etc/X11/xorg.conf. For example, to use the right Windows key one could add
   Option "XkbOptions"  "compose:rwin"

(Finding the right name can be tricky as it varies on different systems. In FreeBSD, one can find the name in /usr/local/share/X11/xkb/keycodes/xfree86. Usually, you're looking for xkb/keycodes/xfree86.). Another way is to use the xev program, find the numeric code and add it to xmodmap. For example, if I want to use the menu key (usually to the right of the right hand Windows key) I run the xev program from an xterm which opens up a little box. (The xev program is usually installed by default, if not, it's readily available for almost all systems. In FreeBSD it's in /usr/ports/x11/xev.)

In the box, hit a key. In the terminal you used to call xev you'll see various things including (if we hit the right Windows key) keycode 116. Now, we create (if it doesn't exist) a $HOME/.xmodmaprc file. In it we add
keycode 117 = Multi_key

Next type
xmodmap ~/.xmodmaprc

If you now hit the right hand Windows key, then type _a, you'll see ā. So, I can use this to write, for example, jūdō.



Using framebuffer, one can now input Japanese in console. I'll add to this as I try it in different systems. To date, I've tried in Fedora, Lubuntu, and Mint and the process was fairly simple.

The fcitx folks have a page on it. In all cases, I already have fcitx working with either anthy or mozc in X. In Fedora install fcitx-fbterm with dnf install fcitx-fbterm. Make sure you have fbterm installed. When I tried it, it wasn't pulled in as a dependency, so I also had to run dnf install fbterm.

In Lubuntu it's apt-get install fcitx-frontend-fbterm. In Mint, it was apparently already installed when I'd installed fcitx.

After that, the procedure is fairly similar. To give an ordinary user access to fbterm, first run
sudo setcap 'cap_sys_tty_config+ep' /usr/bin/fbterm

(In Fedora you can also use /bin/fbterm--both point to the same place)
Add your account to the video group. If your username is john then
usermod -G video -a john

Log out and log back in so the group change can take effect.

If you're already in X and fcitx is already running, you can go to console with ctl+alt+F1 in Lubuntu and Mint, (F2 in Fedora) and type

This will start fbterm and use the already running instance of fcitx. In the fbterm, you can hit ctl+space and enter Japanese as you would with fcitx in X. To change back to English (or your language) hit ctl+c again. This actually produces a strange character on the screen but if you hit return, you'll get a message that the command wasn't found and what you type afterwards will be in normal English letters.

If you are just in console without X, then you can run
fcitx-fbterm-helper -l

That's a lower case L as in launch. That will launch fcitx and put you into framebuffer terminal.

Once you've done this, you can ssh into another machine and, on the remote machine, also use Japanese in the ssh session. Results may vary--for example I wasn't able to input Japanese on a remote FreeBSD-11-CURRENT machine, but it generally works. (It also works if the local machine is running fcitx-mozc or anthy in an X session, using urxvt or other UTF-8 capable terminal to ssh to a remote machine.)