Starting with gtk2-runtime-2.16.6-2009-12-01, the GTK+ installer supports controlling of its (un)installation options through command line arguments. This allows you to embed GTK+ into your own installers while maintaining full control over it. It also allows you to easily deploy GTK+ across multiple systems without having to use any GUI elements.

This document describes the command line options of the latest available version of GTK+ installer.

Installer options:

  • /S - Enable silent mode (don't show any dialog boxes during the procedure).
  • /setpath=yes|no - Add GTK+ to PATH environment variable. Silent mode only. Default: yes.
  • /sideeffects=yes|no - Setting this to no will make the installer avoid any changes to the system (writing to registry, PATH or start menu). If set to no, /setpath is set to no too. Silent mode only. Default: yes.
  • /dllpath=bin|lib|root - Install DLL files to <instdir>\bin, <instdir>\lib, or <instdir>\, respectively. Silent mode only. Default: bin.
  • /translations=yes|no - Install additional translations. Silent mode only. Default: no.
  • /compatdlls=yes|no - Install DLLs which used to be installed by default, but are no longer required by GTK+. Silent mode only. Default: no.
  • /D=C:\Program Files\Foo - Specify installation directory (without any quotes or backslashes). This must be the last argument on the command line. Default: {program files}\GTK2-Runtime.

Uninstaller options (for <instdir>\gtk2_runtime_uninst.exe):

  • /S - Enable silent mode (don't show any dialog boxes during the procedure).
  • /remove_config=yes|no - Remove GTK+ settings too (they may be useful for future installations). Default: no.
  • /sideeffects=yes|no - If you used this option during installation, you MUST set this to the same value. Silent mode only. Default: yes.
  • /dllpath=bin|lib|root - If you used this option during installation, you MUST set this to the same value. Silent mode only. Default: bin.
  • /translations=yes|no - If you used this option during installation, you MUST set this to the same value. Silent mode only. Default: no.
  • /compatdlls=yes|no - If you used this option during installation, you MUST set this to the same value. Silent mode only. Default: no.
  • _?=C:\Program Files\Foo - Specify installation directory (without any quotes or backslashes). This must be the last argument on the command line. There is usually no need to use this option.

See NSIS documentation for other standard options of NSIS installers.

For example, to install GTK+ to a program directory, one could use:
gtk2-runtime-<version>.exe /sideeffects=no /dllpath=root /translations=no /compatdlls=no /S /D=$INSTDIR
where $INSTDIR is a directory you're installing your program to.
To uninstall it, one could use:
$INSTDIR\gtk2_runtime_uninst.exe /remove_config=yes /sideeffects=no /dllpath=root /translations=no /compatdlls=no /S

If you use NSIS to make your application installer, you can use gsmartcontrol.nsi file from GSmartControl as an example. It contains a number of features, like:

  • generating both GTK+ and no-GTK+ installers;
  • detecting existing GTK+ installations;
  • installation of private or shared GTK+.