glib-compile-schemas
Compile GSettings schemas
SYNOPSIS
glib-compile-schemas [OPTION...] DIRECTORY...
PARAMETERS
--targetdir=DIRECTORY
Specify the directory where the compiled gschemas.compiled file should be placed. If not specified, the output is written to the first directory passed as an argument.
--strict
Exit with an error if any warnings are encountered during compilation (e.g., malformed schemas).
--no-clean
Do not remove temporary files created during the compilation process. Useful for debugging.
--dry-run
Perform all checks and validations but do not actually write any files to disk. Useful for testing.
--validate
Only validate the schema files for correctness and well-formedness, without actually compiling them into a binary cache.
--version
Display the version information of the glib-compile-schemas utility.
--help
Show a help message with available command-line options.
DESCRIPTION
The glib-compile-schemas command is a crucial utility within the GLib library, designed to optimize the performance of the GSettings configuration system.
GSettings uses XML schema files to define application settings, including their types, default values, and descriptions. While these XML files are human-readable and easy to manage, directly parsing them at runtime for every application could be inefficient. To address this, glib-compile-schemas takes one or more directories containing these XML schema files and compiles them into a single, compact, and efficient binary cache file named gschemas.compiled.
This compiled binary file allows GSettings to load and access schema information much faster, significantly improving application startup times and overall responsiveness when dealing with configurations. It is typically run during the installation of software packages that use GSettings, ensuring that the schemas are pre-compiled and ready for use by the system's applications.
CAVEATS
For optimal performance, ensure glib-compile-schemas is run whenever new GSettings schema files are added or existing ones are updated in a system directory.
The command requires write permissions to the target directory. If run in a system-wide path like /usr/share/glib-2.0/schemas/, it typically needs root privileges or to be executed as part of a package manager's installation script.
TYPICAL USAGE CONTEXT
This command is primarily invoked by package managers or build systems when installing or updating applications that use GSettings. End-users generally do not need to run it manually. After installing or updating an application with new GSettings schemas, the package manager often triggers a system-wide schema recompilation to ensure all applications have access to the latest configuration definitions. Common schema directories include /usr/share/glib-2.0/schemas/ or application-specific share/glib-20/schemas/ paths within their installation prefix.
SCHEMA FILE LOCATION
GSettings schema files are typically found in the share/glib-2.0/schemas/ subdirectory of an application's installation prefix. For system-wide schemas, this is often /usr/share/glib-2.0/schemas/. When glib-compile-schemas is run, it looks for .gschema.xml files in the specified directory and compiles them into a single gschemas.compiled file in the same or target directory. This compiled file is then used by GSettings applications to load configuration information.
HISTORY
glib-compile-schemas is an integral part of the GLib library, which is a fundamental building block for GTK+ and the GNOME desktop environment. Its development aligns with the evolution of GSettings, which superseded GConf as the preferred configuration system for modern GNOME applications and other software leveraging GLib.
The need for schema compilation arose to improve the efficiency of reading configuration data, moving from runtime XML parsing to a pre-compiled binary format. This shift was part of a broader effort to enhance application performance and consistency across the Linux desktop.
SEE ALSO
gsettings(1), gvariant(7), gio-querymodules(1)