fc-cache
Update font cache after installing new fonts
TLDR
Generate font cache files
Generate font cache files verbosely
Force a rebuild of all font cache files, without checking if cache is up-to-date
Erase font cache files, then generate new font cache files
Scan a specific directory
Scan system-wide directories, skipping the user's home directory
Display version
SYNOPSIS
fc-cache [ -frsvV ] [ --really-force ] [ --system-only ] [ --verbose ] [ --version ] [ --help ] [ dir... ]
PARAMETERS
-f, --force
Force the regeneration of the cache files, even if they appear to be up-to-date.
-r, --really-force
An older option that behaves similarly to --force, typically meaning to remove existing caches before rebuilding. On modern systems, it's often synonymous with --force.
-s, --system-only
Scan only the system-wide font directories and caches (e.g., /var/cache/fontconfig) and ignore user-specific directories (e.g., ~/.cache/fontconfig).
-v, --verbose
Print verbose status information while scanning and building caches, showing which directories and fonts are being processed.
-E, --config=file
Specify an alternative configuration file to use instead of the default.
-V, --version
Display the fontconfig version and exit.
-h, --help
Display a brief help message and exit.
dir...
Optional: One or more directories to scan for fonts. If no directories are specified, fc-cache scans all directories listed in the active fontconfig configuration.
DESCRIPTION
fc-cache is a utility program provided by the fontconfig library. Its primary purpose is to scan the directories specified in the font configuration files (e0g., /etc/fonts/fonts.conf or user-specific files) for fonts and create or update binary cache files. These cache files allow fontconfig and applications that use it to quickly look up available fonts and their properties without having to scan the font directories every time.
When you install new fonts, remove existing ones, or modify your font configuration, it is often necessary to run fc-cache to ensure that your system's font information is up-to-date. This command typically runs automatically during font package installation, but it can also be invoked manually by users or administrators to troubleshoot font-related issues or to force a cache regeneration. The cached data includes font names, styles, weights, character sets, and other metadata essential for font matching and selection.
CAVEATS
Permissions: fc-cache requires appropriate write permissions to create or update cache files. System-wide caches (in /var/cache/fontconfig) typically require root privileges (e.g., running with sudo). User-specific caches (in ~/.cache/fontconfig) only require user permissions.
Cache Corruption: Although rare, corrupted cache files can sometimes lead to font display issues. In such cases, manually deleting the cache directories (/var/cache/fontconfig/ and ~/.cache/fontconfig/) and then running fc-cache -f -v can resolve the problem.
Performance: While generally fast, running fc-cache on systems with an extremely large number of font directories or fonts can take a noticeable amount of time.
CACHE LOCATIONS
fc-cache creates binary cache files in specific locations. System-wide caches are typically found in /var/cache/fontconfig/, while user-specific caches are stored in ~/.cache/fontconfig/. These directories contain subdirectories for various font-related configurations and locale-specific caches.
WHEN TO RUN
You usually don't need to run fc-cache manually as it's often triggered automatically when font packages are installed or updated by your system's package manager. However, you might run it if you:
1. Manually add or remove font files to font directories.
2. Experience font display issues after system updates or configuration changes.
3. Modify fontconfig configuration files (e.g., fonts.conf) directly.
HISTORY
The fontconfig library and its associated utilities, including fc-cache, were primarily developed by Keith Packard, starting around 2000. Its creation was a crucial step in standardizing font management on Linux and other Unix-like systems, providing a robust, extensible, and predictable way for applications to discover and select fonts. Before fontconfig, font handling was often ad-hoc and inconsistent across different desktop environments and applications. fc-cache emerged as a necessary tool to optimize this process by pre-generating font metadata, significantly improving application startup times and font rendering performance.