Tx · LaTeX & TikZ

How to Fix “I Can’t Find the Format File xelatex.fmt” on Linux

Published By the 9to5Science editorial team

At a glance

  1. 1. Check the executable

    Confirm which XeLaTeX binary and TeX tools your shell is using.

  2. 2. Check for the format

    Use kpsewhich to see whether xelatex.fmt is present in TeX’s search path.

  3. 3. Rebuild the format

    Run fmtutil for the system or user installation that provides XeLaTeX.

  4. 4. Repair mismatched installs

    Install the XeTeX package or resolve conflicts between multiple TeX distributions.

The message “I can’t find the format file xelatex.fmt” means the XeLaTeX program cannot locate the precompiled format it needs to start. The usual causes are an incomplete TeX installation, a format that was not generated, or a shell using the XeLaTeX executable from one TeX installation and format-search tools from another.

Work through the checks below in order. Use the commands for the same TeX distribution that provides your xelatex executable; avoid mixing a Linux distribution’s TeX packages with a separate TeX Live installation.

1. Check which TeX installation is active

In a terminal, run:

type -a xelatex kpsewhich fmtutil-sys
xelatex --version

type -a lists matching commands on your PATH. If it shows multiple xelatex executables, the first one is normally the one your shell runs. The version output can also help identify which distribution is active.

Multiple installations are common—for example, a TeX Live installed from the Linux distribution’s package manager and another installed directly from the TeX Live installer. If the executable and the associated tools come from different installations, they may look in different directories for formats.

2. Check whether the format is visible

Run:

kpsewhich xelatex.fmt

If this prints a path, the format is visible to that kpsewhich command. If it prints nothing, the format is either missing or outside the active TeX installation’s search paths. Also check that kpsewhich belongs to the same installation as xelatex; the output of type -a helps with that.

For example, if xelatex --version points to a TeX Live installation under /usr/local/texlive, but the first kpsewhich is from /usr/bin, you may have a mixed PATH. Adjust your shell’s PATH so that the intended installation’s bin directory comes first, then open a new terminal and repeat the checks.

3. Regenerate the format

If the right installation is active but kpsewhich finds no format, ask TeX’s format utility to build it. For a system-wide TeX Live installation, run:

sudo fmtutil-sys --byfmt xelatex

For a user-level format in your own TeX tree, run:

fmtutil --byfmt xelatex

Use the system command for a system installation and the user command for a user installation. The utility should report whether it successfully generated xelatex.fmt. Then check again:

kpsewhich xelatex.fmt
xelatex sample.tex

Replace sample.tex with your document’s filename. If format generation fails, read the first error in its output: it may indicate that XeTeX or a required package is missing, or that the configuration for the selected installation is damaged.

4. Install the XeTeX components if they are missing

If fmtutil cannot build the format because XeTeX is not installed, install the XeTeX package through the package manager that manages your TeX distribution. On Debian or Ubuntu, the package is commonly installed with:

sudo apt update
sudo apt install texlive-xetex

Other Linux distributions use different package names and package managers. If you installed TeX Live directly from its installer, use that TeX Live installation’s package-management tools instead of installing a second TeX distribution through the operating system. After installation, retry the format-generation command if the package manager has not generated the format automatically.

Common mistakes

  • Running fmtutil from the wrong installation. Check command locations with type -a and make sure the tools match the active xelatex.
  • Using sudo unnecessarily or in the wrong place. fmtutil-sys manages system-wide formats and normally needs administrator permission. fmtutil manages the user’s formats and usually should run without sudo.
  • Reinstalling all of TeX Live immediately. First check whether the format is merely absent and whether multiple installations are competing. A targeted package installation or format rebuild may be enough.
  • Mixing package managers. If your TeX installation came from your Linux distribution, manage it with that distribution’s package manager. If it came from the TeX Live installer, use that installation’s tools. Mixing them can leave executables and format files out of sync.

A successful kpsewhich xelatex.fmt lookup followed by a successful XeLaTeX run confirms that the active installation can find and use its format.

References

  1. TeX Live documentation
  2. fmtutil manual page

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.