Inputting Japanese text in Linux and some BSDs

Table of Contents (TOC)

RedHat-8-9x, and friends
Fedora (F42)
Gentoo
Lubuntu and Ubuntu (14.04, 15.04-21.10)
Linux Mint (6.22.1)
Debian (Bookworm)
MXLinux
Arch Linux
VoidLinux
Alpine Linux
FreeBSD
OpenBSD
DragonFlyBSD-5.x
fcitx-fbterm
Wayland

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]gmail.com.

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 translate.google.com, 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 a few that only have ibus (e.g., RHEL9). This page will only cover fcitx5. The somewhat older fcitx is similar, though the profile file may be different.

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. I've left in some that I haven't worked with in years, such as DragonFlyBSD.

TOC

RedHat and friends

(Last update July, 2025)

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. (I believe you need to have RH access to see the article. There are reasons many people dislike RedHat). 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.

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.

(RHEL-8 and friends don't have fcitx5. Most of the other sytems covered below do have it).

RHEL9 and clones don't have fcitx. 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.

You may have to after installing ibus-anthy, log out, and then, after logging in, go back to the keyboard and select. There should be an option for Japanese (anthy) and you can add it. This hasn't been consistent for me. RedHat has their own page on it here.

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.

If you are using the kitty terminal emulator, you also need to add export GLFW_IM_MODULE=ibus to .xinitrc

As of February 2025, RedHat has ibus-mozc (they may have gotten it earlier, but that's when I noticed). I found that it didn't work well for me and so I went back to ibus-anthy, which, for me at least, consistently works.

There is now RHEL10. I have a page on using it with labwc or dwl, two lighter weight window managers. However I couldn't even get ibus working with those two. On a standard workstation install, however, it's fairly straighforward. First install ibus-anthy, which seems to be the only one available in RHEL10. We are assuming you're using the default Gnome desktop.

Go to settings, or just type keyboard into the search box. Look for Region and Language. It should show English and a plus sign on the the bottom. Click the plus sign and look for Japanese. It should show Japanese and when you click on that, give you the option of Japanese (Anthy). If it doesn't, but only shows things like kana and such, try logging out and logging back in.

Anyway, once you click on Japanese (Anthy) you can click the add button. You might have to log out and in again, or it may start working immediately. The default keyboard shortcut is Super (the Windows key)+space. If you prefer to use different keys, you can run ibus-setup which will give you the option of changing the default keys.

TOC

Fedora

(Last update, July, 2025)

Fedora's workstation comes with ibus, however, we're going to use fcitx5. As we're using Fedora 39 or higher, we'll use dnf rather than yum. The Fedora workstation runs Gnome which runs ibus by default. The only way I found to keep ibus from running on Gnome login is to rename /sbin/ibus-daemon to something like ibus-daemon.bak.

I should mention that like CentOS and clones, if one chooses 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. I use mozc, which is available.

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 fcitx5-mozc

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 also add default-fonts-cjk-mono and default-fonts-cjk-serif.

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=xim
export QT_IM_MODULE=fcitx

If using the kitty terminal emulator, you also have to add export GLFW_IM_MODULE=ibus, even though you're using fcitx5. If I want it to start each time I start X, I can add fcitx5 -d -r below the export (but above the line to exec the window manager).

Now we need to edit $HOME/.config/fcitx5/profile.

The best way to do this is with the fcitx5-configtool, and it's what is recommended on fcitx5's pages. If using a GUI login manager, such as with the LXDE spin, fcitx5 may already be running if you log out and log back in. Otherwise, once X is started, start fcitx with the command fcitx5 -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. There should now be a file in $HOME/.config/fcitx5 called profile. Edit this $HOME/.config/fcitx5/profile with your favorite text editor. Change it to read
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=mozc

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=

[GroupOrder]
0=Default

That's assuming you're using mozc. If using anthy, put in anthy wherever I have mozc in the example above.

The reason I say use fcitx5-configtool is that if you just start and stop fcitx5, while a $HOME/.config/fcitx5/profile file will be created, it may be missing a stanza, usually the [Groups/0/Items/0] one. While one doesn't change anything in that stanza, it is still necessary. Otherwise, Japanese input may not work (in Fedora 42, for example) or when fcitx5 is started, you'll have Japanese input and not be able to use keyboard hotkeys to get to English input (FreeBSD).

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 fcitx5 -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, fcitx5 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 fcitx5-anthy or any fcitx5 input manager, first disable ibus as mentioned. While there is an im-chooser rpm, when I ran it, it said it wasn't supported with my desktop, so I just renamed the ibus-daemon, as I've mentioned. I use X, but if using wayland, 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, 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. Later I learned they should go into $HOME/.config/lawc/environment. In short, if using Gnome, once you set it up, as described above, Gnome didn't require me to put the variables anywhere, it just worked as soon as I started fcitx5. With Gnome ,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.

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

Again, if using the kitty terminal emulator, also add export GLFW_IM_MODULE=ibus.

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.

TOC

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
im-config

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 https://launchpad.net/~fcitx-team/+archive/ubuntu/nightly. 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.

TOC

Linux Mint

(Last update July, 2025)

Mint has become so simple to setup with Japanese that it hardly merits an entry. The below applies to all three of its install versions, Mate, Cinnamon, and XFCE4

Once installed, open a a terminaol and install fcitx5-mozc with apt.
apt install fcitx5-mozc

Now run fcitx5-configtool. It will show as a greyed out box, saying fcitx5 is not running, do you want to start it. Click yes.

Now a box opens, showing English on the left. On the right, there is a search box. You don't even have to uncheck only show installed lanagues. Type in mozc in the search box, when it shows up, hightlight it, and then you can click the arrow pointing left which will put under the entry for English. Log out, log back in, and Japanese works with the key combo of ctl+space. When you log back in, fcitx5 is already running.

I decided to also install openbox. I installed it, logged out, when I logged back in, there was a little icon to choose whether I wanted openbox or XFCE4, and once I had logged into openbox, I found that fcitx5 was already running and I could use Japanese in any application I tried. Well, the three I tried, terminal, firefox, and libreoffice, so it worked with both GTK and QT applications.

TOC

Debian Bookworm

(Last updated July, 2025)

Once you have X working, install fcitx5-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 fcitx5-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=xim
export QT_IM_MODULE=fcitx 

Again, I've not used kitty with Debian but I assume you also need the export GLFW_IM_MODULE=ibus for kitty to show Japanese.

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 fcitx5 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 fcitx5-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, highlight it, click the arrow to move it into the left column and you're returned to the main dialog window. Click apply and then close. Now, if you hit ctl+space in any application that accepts Japanese input, you should see a little box saying hiragana, or maybe only showing hiragana characters, or perhaps mozc.

TOC

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
id:3:default

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

TOC

ArchLinux

(Last update July, 2025)

ArchLinux has packages for fcitx5-mozc. 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, alacritty, firefox, google-chrome-stable, and libreoffice.

Install with pacman
pacman -S fcitx5-mozc 

Install fonts. I use the noto-cjk fonts.
Pacman -S noto-fonts-cjk

Once installed, setup is similar to the Fedora setup. Once, you could once just run fcitx5, then stop it, and there would be a $HOME/.config/fcitx5/profile that you could edit manually, but these days, it seems that fcitx5 no longer does that. Like Fedora, this can be done manually. Start X then start fcitx5. Then kill X. This should create a $HOME/.config/fcitx5 directory. In there you will find a file called profile. Open it with your favorite text editor.
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=mozc

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=

[GroupOrder]
0=Default

You could add all that manually, but it's easier to use the fcitx5-configtool. In Arch's case, you'll need the fcitx5-configtool-qt package as well to get fcitx5-configtool to work. 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=xim
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=xim
export QT_IM_MODULE=fcitx
fcitx5 -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.

Again, if using kitty as your terminal emulator, also add export GLFW_IM_MODULE=ibus.

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 installed fcitx5-gtk2 and fcitx5-gtk3. If you're using qt apps as well, such as libreoffice, be sure to install fcitx5-qt with pacman -S.

I've found that if use GTK_IM_MODULE=fcitx instead of xim, that firefox and other gtk apps may not work with Japanese.

TOC

VoidLinux

(Last update February 2024)

As of February, 2024, and probably earlier, Void has fcitx5-mozc. So install it and get fonts as well. So install with
 
xbps-install -Sy fcitx5-mozc noto-fonts-cjk

which should pull in most things needed. Like others mentioned here, to get firefox working, your .xinitrc should have export GTK_IM_MODULE=xim. The $HOME/.config/fcitx5/profile should read
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=mozc

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=

[GroupOrder]
0=Default

As with other sytems, one runs fcitx5 -d to use fcitx5-mozc.

If you need fonts, Void has the noto-fonts-cjk package. Install it with xbps-install -S noto-fonts-cjk.

I've not used kitty on Void yet, but I assume you also need the export GWFW_INPUT_MODULE=ibus for it to work with Japanese. TOC

Alpine Linux

(Last update July, 2025)

I've only used Alpine with Japanese in a FreeBSD Bhyve virtual machine. Most of it was pretty straightforward. It has fcitx5-anthy or fcitx5-kkc, I tried with anthy. Install fcitx5-anthy and noto fonts.
doas apk add fcitx-anthy font-noto-cjk

I've been running it with openbox, booting into text mode and starting with startx, so my $HOME/.xinitrc reads
export XMODIFIERS="@im=fctix"
export GTK_IM_MODULE=xim
export QT_IM_MODULE=fctix
export LC_CTYPE=en_US.UTF-8
exec openbox-session

Also, I've found that I need to install dbus-x11. If I don't then fcitx5-configtool may not work.

The first time I started fcitx5 and stopped it as I usually do. Then I went to manually edit $HOME/.config/fcitx5/profile, but when I then tried to use anthy, it would input Japanese, but I could not get back to English unless I clicked with the mouse on the icon in the tint2 bar that I use with openbox.

I then used fcitx5-configtool (see the note about dbus-x11 above), added anthy that way and it worked. In later installs I was able to manually edit profile--apparently the one that was created when I just ran and then closed fcitx5 was missing a stanza.

Regardless, whether one uses the configtool or manually edits the file, the $HOME/.config/fcitx5/profile should read
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=anthy

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=anthy
# Layout
Layout=

[GroupOrder]
0=Default

It seems as though Alpine's fcitx5, when it automatically creates that profile file, left off the Groups/0/Items/0 stanza, which seems to have made it so that I couldn't use ctl+shift to toggle between Japanese and English. So, if you're unable to use keyboard toggling, double check your profile file.

If using fcitx5-configtool, you don't have to start fcitx5 first. It uwill give an option to start fcitx5. As mentioned elsewhere in this article,it will probably show English, you have to uncheck the box saying only show current language, search for anthy, highight it and then click the arrow to move anthy over to the left side. After that it should just work.

I tried in alacritty terminal, firefox, and libreoffice and all worked.

When I didn't use fcitx5-configtool, and tried editing $HOME/.config/fcitx5/profile manually, I must have messed up the syntax. Because then, while I was able to input Japanese, I couldn't get the hot keys to switch me back to English. I had to click on the anthy icon, and then choose direct input.

FreeBSD

(Last update February, 2024)

FreeBSD has been the same for several versions, but I'm just covering FreeBSD-14.1, the RELEASE version at time of writing. Note that now fcitx5-anthy is available. For those who prefer it, you can just install, with pkg, ja-fcitx5-anthy. If you want it to work with libreoffice, you also have to install fcitx5-qt5. The pkg-message suggests using GTK_IM_MODULE=fcitx/xim however, I've found that in my .xinitrc, where I set these variables, that what you actually need is export GTK_IM_MODULE=xim. This is needed if you want to use Japanese in firefox.

I've also found, that on a couple of test installs, I simply could not get libreoffice or other qt apps, such as the lightweight featherpad, to work with Japanese, unless I edited my .xinitrc. My usual .xinitrc will have exec openbox-session or exec dwm, depending upon which window manager I'm using. On one laptop install and one VirtualBox install, qt apps wouldn't work, unless I changed my .xinitrc to read, (this is with openbox, but the same with dwm)
exec dbus-launch openbox-session

I'm not sure why, as dbus was running, and I didn't have to do this on my main workstation, but at any rate, that's how I could get it to work with qt based applications, if they weren't working. It also isn't necessary if using xfce4. (Or probably any desktop environment, but I only checked with xfce4.) On the installs where qt apps weren't working it was the same whether I used openbox, dwm, or fluxbox. Each window manager had to be called with exec dbus-launch <desktop_name>

And yet, this isn't consistent. Another test install didn't work with QT apps when I used dbus-launch, but worked with QT when I didn't add the dbus-launch part. This is on a machine which also has a VirtualBox install. On the VBox install, I need the dbus-launch, on the actual workstation install not only do I not need it, but it breaks using fcitx5-anthy with QT apps. So, at this point, I would say, try normally, and if it doesn't work, try adding dbus-launch <window_manager> in your .xinitc.

Also, I've found that FreeBSD's included vi, which is actually a version of nvi, wouldn't input Japanese. If I hit control space and input characters they show up in the little converter window, but when I hit enter, they don't show up in the file I'm working on. However, it works with vim, though not with vim-tiny, which does the same as vi, shows the conversion, but won't write it to screen.

As with other systems, if using the kitty terminal emulator, you also have to add export GLFW_IM_MODULE=ibus to whereever you set your environment variables.

If you look at the Wayland section (or even if you don't) on the same installations that gave me trouble with QT apps in a window manager, I had the same issue with the Wayland equivalents, labwc, an openbox replacement. I'd have to start it with dbus-launch labwc to be able to use Japanese in QT applications. In the Wayland section, I mention putting the environment variables in $HOME/.config/labwc/environment, however, even doing that, I couldn't get labwc to work with Japanese in GTK applications, only (if I started it with dbus-launch), urxvt and libreoffice.

With fcitx (as opposed to fcitx5), the easiest way I've found to configure it is to startx, then run fcitx -d. Stop X, and in your $HOME/.config, there should be an fcitx/profile file. This should have a long list of input managers, and one should be mozc. It will read mozc:False. Change the False to True, save the file, and staart X again. Once again, run fcitx -d, and you should be able to input Japanese. If not, you may be able to get it working with the package zh-fcitx-configtool, but, as I've not needed it, I haven't tried it. It may also be necessary, if using the older fcitx, to install fcitx-qt5 to get libreoffice to work. My results haven't been consistent.

Sometimes, you will have to go through running startx, running fcitx -d, then closing X and looking at the .config/fcitx/profile a couple of times before that long list of input methods shows up, but again, I've not had to deal with it in awhile.

The older version of fcitx is available with mozc. If you'd prefer that, do pkg install ja-fcitx-mozc, but I'm mostly covering fcitx5. This is a reason to use the older version, fcitx5 only has anthy, but the older fcitx has mozc.

I should also mention that on a couple of installs, I was unable to get fcitx5-anthy to work with Firefox and other GTK apps. This has not been consistent, so I may have overlooked something, as there were other times when it worked. But, if you've installed fcitx5-anthy and can't get Japanese in GTK applications, I'd recommend removing it and installing 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.

One 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 fcitx5-anthy tells you to add variables and commands to start fcitx to your .xinitrc file (or .xession, if you use that.) It suggests adding
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx/xim
export QT_IM_MODULE=fcitx

I've found, if I do that, firefox wouldn't work with Japanese, it had to be GTK_MODULE=xim, not fcitx/xim.

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/fcitx5/conf.

There is a package, fcitx5-configtool. I've not used it, as it's so easy to do manually. While X is not running, edit your $HOME/.config/fcitx5/profile to read
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=anthy

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=anthy
# Layout
Layout=

[GroupOrder]
0=Default

Start X, run fcitx5 -d, and you should be able to input Japanese when you hit ctl+space.

Actually, if one installs the package, there are instructions on how to run it when ever X starts, which can be viewed with pkg info -D fcitx5.
cp /usr/local/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/

This may only be for desktop environments, as it hasn't worked for me with openbox or dwm, though you can certainly add fcitx -d to your $HOME/.xinitrc file. (Before the line calling the window environment, which has to be the last line.) If you do use that, note that you'll have to create a $HOME/.config/autostart directory if it doesn't exist.

Although I'm no longer using ibus-mozc in FreeBSD, I'm leaving in this next part because it was a lot of work. I went through it back around FreeBSD-10, but it may still be the case. (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.
#!/bin/sh
if [ `ibus engine` = 'mozc-jp' ]; then
  ibus engine xkb:us::eng
else
ibus engine mozc-jp  #or whatever IME you prefer; change it above too.
fi

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

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

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">
<command>imswitch.sh</command>
</action></keybind>

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 imswitch.sh 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[] = {"imswitch.sh", 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 imswitch.sh 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 imswitch.sh 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 fcitx5, especially with multiple monitors, where, unlike ibus, it had no trouble.

TOC

OpenBSD

(Last update July, 2025)

One installs with pkg_add fcitx-anthy. This installs fcitx5. As with other systems, one has to add some environment variables--I use $HOME/.xinitrc.
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=xim
export QT_IM_MODULE=fcitx
export LC_ALL=en_US.UTF-8
exec openbox-session

That one is if using openbox as the window manager.

At one point OpenBSD only used the xenodm display manager so I couldn't easily drop out of X, edit .config/fcitx5/profile and restart X. Instead, I edited the profile, openbox, my usual window manager and logging in again. I got different results with different VM 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.

If using xenodm, you may also need to add the XMODIDFIERS=@im-fcitx, etc., to .xsession which is preferred to .xinitc with OpenBSD, when using xenodm.

You can't run fcitx -d, you have to run fcitx5 -d. The configuration file is in $HOME/.config/fcitx5/profile. I edit it to read
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=anthy

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=anthy
# Layout
Layout=

[GroupOrder]
0=Default

When I installed fcitx-anthy, it also installed fcitx-configtool--keep in mind that though they're called fcitx it's actually fcitx5. When I tried to run the configtool, it wouldn't open. I'm not sure what else it needs--I tried pkg_add dbus-x11 but there was no such package. So, I just edited $HOME/.config/fcitx5/profile to read as above, ran fcitx5 -d and it worked. You will need fonts, I installed noto-cjk.

7.7 doesn't require xenodm, you can use an .xinitrc file with startx.

One final note, OpenBSD's vi won't work with Japanese. Install nvi, which has no problem. When you install nvi, it gives you a choice of nvi or nvi-iconv, choose nvi-iconv (the other doesn't work right.) So, if you need to edit a text file and include Japanese, open it with nvi, not vi.

TOC

DragonFlyBSD-5.x

(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.

TOC

Using Putty from Windows

Much of this was taken from this page from umiacs.umd.edu.

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.

TOC

Romaji

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
LETTER A WITH MACRON

(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ō.

TOC

fcitx-fbterm

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
fcitx-fbterm-helper

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.)

TOC

Wayland

RedHat is supposedly dropping X for Wayland in RHEL10. If you use Fedora's default of Gnome workstation, you probably won't see a difference. As I prefer dwm and openbox, I wondered how it might affect my workflow if X was gone, so I tried Wayland on Fedora and FreeBSD.

The main difference, for me, at least, is that I usually load my environment variables in .xinit. Both Fedora and FreeBSD have labwc, which is more or less a dropin for openbox. I have more information on my wayland page.

The labwc window manager has (though you'll have to create it), a place for environment variables in $HOME/.config/labwc. Create a file $HOME/.config/labwc/environment, and put your usual variables in there. Mine reads
XMODIFIERS=@im=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
LC_CTYPE=en_US.UTF-8

As usual, if using the kitty terminal emulator also add a line of export GLFW_IM_MODULE=ibus to that file.

This allows me to input Japanese in all the applications I've tried, which at this point are just firefox urxvt, and alacritty. With dwl, I have not gotten Japanese to work well.

With dwl, I can only get Japanese input by using export XMODIFIERS=@im=fcitx and using a urxvt terminal. It doesn't work in alacritty or kitty. And, exporting the other usual things (all mentioned above in the part about labwc) makes no difference. It still won't work in firefox or various terminals. Only in urxvt, and I only need to export the XMODIFIERS variable.

It will work in libreoffice, but ONLY if I call libreoffice from the terminal where I set the variables. In that case, I have to call the QT_IM_MODULE as well. I can export the QT_IM and XMODIFIERS from alacritty as well, and, if I call urxvt or libreoffice from the terminal where I exported the variables, Japanese input will work. I haven't figured out the reasons yet, but to simplify:
If, in alacritty or urxvt I run export XMODIFIERS and export QT_IM_MODULE, I can then, from that terminal, open libreoffice or a urxvt terminal and input Japanese. This doesn't work for firefox though it does for chrome. I may investigate more, but practically speaking, if I'm using Wayland, which I seldom do, and have to input Japanese, which I now do infrequently, I'll probably use labwc.

As mentioned in the FreeBSD section, on some FreeBSD installs, I found that qt apps wouldn't work with Japanese. I had the same experience with Wayland. I would have to use dbus-launch labwc in order to use QT apps with Japanese in Wayland.

I have had limited success with running a little script with dwl--on occasion. I just declare the same environment variables that I use in labwc. So the script will look like
#!/bin/sh
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=xim
export QT_IM_MODULE=fcitx
export LC_ALL=en_US.UTF-8
fcitx5 -d -r
$1 &

I run the script after I've opened a dwl session. I usually only want either a web browser or terminal open, so I might run it as jinput.sh firefox, or jinput.sh alacritty. That's in FreeBSD. In Fedora, as of 11/2024, there is no rpm. I had to build the tarball, from dwl's site. The git version seemed to need a newer version of wlroots so I used the tarball for 0.7. Also, see the page's information about Xwayland. One has to uncomment a couple of lines in config.mk to get Xwayland support, as well as be sure you have libxcb and wlroots-devel. (The page also says you need libxcb-wm, but Fedora didn't have that, and I didn't use it, but Xwayland support worked). The main reason for Xwayland support, for me, was to get urxvt to work, otherwise, it wouldn't open in dwl. so I could only use either xfce4-terminal or gnome-terminal working with Japanese, unless I included Xwayland support.

The script usually doesn't seem to actually export the variables. Usually, I have to specify the variables in a terminal, then call xfce4-terminal or gnome-terminal from the terminal in which I declared the variables. That is, a keyboard shortcut, or starting it from wmenu, won't have the variables in it. (I can, say, open an xfce4-terminal, declare the variables there, and then use that same terminal to input Japanese, but if I want to use Japanese in libreoffice, say, I'll have to call the libre office session from that terminal.

The other possibility is to call the environment variables in ~/.bash_profile. (Not .bashrc, because things like libreoffice, for example, might not involve an interactive shell.) Or, if you use zsh, one can put the variables in ~/.zshenv. Regardless, dwl has various shortcomings with Japanese input, at least with fcitx5, the only method I have tried.

I've not made much use of Fedora's default workstation, which uses ibus and Gnome, but when I did, Japanese worked as it would in X. If one just uses Fedora's defaults, I expect they'll have no problem. However, I always choose a minimal install and install window managers afterwards.

Basically, if I need Japanese, in Wayland, I've been relying on labwc. Again, this is on FreeBSD, in Fedora, I'd use xfce4-terminal. So, if Wayland does become the only alternative, I'll be in good shape, though I don't expect that to be a problem for years.

In FreeBSD, with labwc, and having the variables in .config/labwc/environment, to sum up, with fcitx5-anthy (fcitx5-mozc isn't available as of February 2025), I can get Japanese working in alacritty and firefox. To get it working in libreoffice, though, I have to call libreoffice from the terminal with export QT_IM_MODULE=fcitx to get it working in a libreoffice document. Calling libreoffice from dmenu doesn't work. I don't know why it doesn't read the .config/labc/environment if I do it that way, but so far, aside from experimenting for the sake of this article, I've never needed Japanese in libreoffic in Wayland.

To repeat what I said at the beginning of this article, Japanese input has become pretty easy in Linux and the BSD's, and if you are having problems that weren't solved by this page, you are probably best off going to irc or the forum for your O/S and asking there.