LinuxCommandLibrary

fc-cache

Update font cache after installing new fonts

TLDR

Generate font cache files

$ fc-cache
copy

Generate font cache files verbosely
$ fc-cache [[-v|--verbose]]
copy

Force a rebuild of all font cache files, without checking if cache is up-to-date
$ fc-cache [[-f|--force]]
copy

Erase font cache files, then generate new font cache files
$ fc-cache [[-r|--really-force]]
copy

Scan a specific directory
$ fc-cache [path/to/directory]
copy

Scan system-wide directories, skipping the user's home directory
$ fc-cache [[-s|--system-only]]
copy

Display version
$ fc-cache [[-V|--version]]
copy

SYNOPSIS

fc-cache [-EfrsvVh] [-y cache-dir] [dir …]

PARAMETERS

-E, --error-on-no-fonts
    Emit error if no fonts found in scanned directories.

-f, --force
    Scan and update caches even if they appear current.

-r, --really-force
    Erase existing caches before rescanning (implies -f).

-s, --system-only
    Scan system font directories only, skip user dirs.

-v, --verbose
    Print detailed status during operation; repeatable for more detail.

-y cache-dir, --cache-dir
    Use specified directory for cache files instead of default.

-V, --version
    Display version info and exit.

-h, --help
    Show usage summary and exit.

DESCRIPTION

fc-cache is a key utility in the Fontconfig library, responsible for generating and updating binary cache files that store font metadata for efficient lookup by applications on Linux and Unix-like systems. Fontconfig manages font selection based on styles, weights, and languages requested by programs like GTK, Qt, and web browsers.

When fonts are added, removed, or updated—such as via package managers like apt or manual installation—the cache must be refreshed to ensure applications detect changes. fc-cache recursively scans font directories for TrueType, OpenType, Type1, and other supported files, extracts properties like family name, style, and charset coverage, then builds optimized caches.

By default, it processes both user-specific directories (e.g., ~/.local/share/fonts, ~/.fonts) and system-wide paths (e.g., /usr/share/fonts, configured in /etc/fonts/fonts.conf). Options allow targeting specific dirs, forcing rebuilds, or system-only scans. Verbose output tracks progress, vital for large font collections. Post-install scripts often invoke it automatically, but manual runs ensure immediate availability.

CAVEATS

First run indexes all fonts and can take minutes on systems with thousands of fonts. Requires write access to cache dirs (user: ~/.cache/fontconfig; system: /var/cache/fontconfig, needs root). Non-root runs skip system cache updates.

CACHE LOCATIONS

User caches: ~/.cache/fontconfig/ (e.g., fc-cache-7, 8e:e2fc:fonts-dir).
System: /var/cache/fontconfig/. Files are binary indexes named by hash.

USAGE TIP

After installing fonts: fc-cache -fv for verbose user+system update.
For system-wide: sudo fc-cache -fvs.

HISTORY

Part of Fontconfig, initiated by Keith Packard in 2000 for X11 font handling. Evolved from bitmap fonts to scalable; fc-cache stabilized in Fontconfig 2.0 (2002). Now ubiquitous in desktop Linux distros.

SEE ALSO

fc-list(1), fc-match(1), fc-scan(1), fontconfig(3)

Copied to clipboard