LinuxCommandLibrary

glib-compile-schemas

Compile GSettings schemas

SYNOPSIS

glib-compile-schemas [OPTION...] [PATH]

PARAMETERS

--help, -h
    Print help and exit

--version
    Print version information and exit

--targetdir=DIR
    Place gschemas.compiled in DIR instead of PATH/glib-2.0/schemas/

--allow-any-name
    Allow non-namespaced schema IDs (e.g., without org.example. prefix)

--strict
    Fail on any validation error, including unused keys or gettext issues

--dry-run
    Validate schemas and print actions without writing files

--debug
    Enable verbose debugging output

--timestamp=TIMESTAMP
    Override mtime value in compiled schema (format: seconds since epoch)

DESCRIPTION

glib-compile-schemas is a GLib utility that compiles XML GSettings schema files into a single binary gschemas.compiled database for faster runtime loading.

GSettings is GLib's high-level API for application settings, where schemas (*.gschema.xml) define keys, types, ranges, defaults, and translations. Compiling avoids repeated XML parsing, improving performance.

The tool scans PATH (default: current directory) for schema files, optionally validates translations via gettext catalogs, and writes output to PATH/glib-2.0/schemas/gschemas.compiled (overridable with --targetdir).

Commonly used in build systems (Meson, CMake, Autotools) during 'install' phase to deploy schemas to /usr/share/glib-2.0/schemas/. After installation, run as root or via systemd to update the system schema cache.

Supports strict mode for errors, dry-runs for CI/testing, and debug output for troubleshooting malformed schemas.

CAVEATS

Requires write permissions in target directory.
Schemas must be valid XML; invalid files cause failure.
Run post-install as root or via glib-compile-schemas /usr/share/glib-2.0/schemas to update system cache.

EXIT STATUS

0: success.
1: validation or I/O error.
2: invalid arguments.

FILES

Input: *.gschema.xml, *.gschema.override.
Output: gschemas.compiled.
Optional: gettext .mo for translations.

EXAMPLE

glib-compile-schemas .
glib-compile-schemas --strict --dry-run build/schemas/

HISTORY

Introduced in GLib 2.28 (March 2010) with GSettings support. Enhanced in later versions for relocatable schemas (2.32+) and improved validation.

SEE ALSO

Copied to clipboard