13. Running the Installer

## 13. Running the Installer

You can run an installer either by invoking it from the command line or double-clicking it from your desktop environment. On Linux and other Unix environments, the only requirement is that the file must have executable permissions, which it has by default when it is created. Sometimes those permissions can be lost, such as when downloading an installer from a website. In that case you can restore the executable permissions with:

    chmod u+x installbuilder-professional-15.9.0-linux-installer.run

Because the generated OS X installers are regular .app applications, they contain a directory structure and you will need to add them to a zip file or disk image for distribution over the web. On OS X, when a user downloads a zip file containing an application, it will automatically be unpacked and the user will be prompted to launch it.

On Windows, the installer runs graphically with a native look and feel or it can be invoked in unattended mode (see below). On Mac OS X, the installer runs with the native Aqua look and feel and can also be run in text and unattended modes. On Linux and other supported Unix systems, there are multiple installation modes:

- GTK: This is a native installation mode based on the GTK 2.0 toolkit. The GTK libraries must be present on the system (they are installed by default in most Linux distributions). This is the default installation mode. If the GTK libraries are not available, the X-Window installation mode will automatically be used instead. The GTK mode is available on Linux and Linux x64 only.
- Qt: This is a native installation mode based on Qt. The Qt libraries are compiled into the installer, so it is not necessary for them to be present on the end-user system. This mode is only available on Linux, Windows and Mac OS X when using the InstallBuilder for Qt product.
- X-Window: This is a self-contained installation mode that has no external dependencies. It will be started when neither the GTK nor the Qt mode is available. It can also be explicitly requested with the `--mode xwindow` command line switch.
- Command line: Designed for remote installations or installation on servers without a GUI environment. This installation mode is started by default when a GUI is not available or by passing the `--mode text` command line option to the installer.
- Unattended Installation: It is possible to perform unattended or silent installations using the `--mode unattended` command line option. This is useful for automating installations or for inclusion in shell scripts, as part of larger installation processes.

### 13.1. Requiring Administrator Privileges

You can require administrator privileges in your installer by using the `<requireInstallationByRootUser>` tag:

      <project>
        ...
        <requireInstallationByRootUser>1</requireInstallationByRootUser>
        ...
      </project>

This will require the end user to have root privileges on Unix platforms (possibly using sudo to invoke the installer) or Administrator privileges on Windows. If the user does not have the appropriate privileges, an error will be displayed and the installer will exit. In the case of OS X, the user will be prompted with an Admin password dialog to raise its privileges.

Once running, you can check whether the installer is running as administrator by checking the `${installer_is_root_install}` built-in variable:

    <showText text="You are not administrator!">
      <ruleList>
        <isFalse value="${installer_is_root_install}"/>
      </ruleList>
    </showText>

When running on the latest Windows versions (Vista and newer), if the UAC is enabled, the installer will be forced to be executed as Administrator by default, regardless of the value of the `<requireInstallationByRootUser>` tag. This behavior is forced by the OS but can be also configured in the project using the `<requestedExecutionLevel>` tag:

    <project>
       ...
       <requestedExecutionLevel>requireAdministrator</requestedExecutionLevel>
       ...
    </project>

The allowed values for this setting are:

- requireAdministrator - Require administrator: This is the default value and forces the installer to be executed as an administrator user. All users are forced to introduce valid administrator credentials.
- asInvoker - As invoker: This setting allows the installer to execute with the current privileges level. Any user can run the installer without the UAC requesting his credentials.
- highestAvailable - Highest available: This setting makes the application to run with the highest privileges the user executing it can obtain. A regular user won’t be prompted for credentials (as it cannot raise its privileges) but a member of the Administrators group will be prompted.

Under these circumstances, if want you installer to do not require administrator privileges, you should configure the settings below in your project:

    <project>
       ...
        <requireInstallationByRootUser>0</requireInstallationByRootUser>
       <requestedExecutionLevel>asInvoker</requestedExecutionLevel>
       ...
    </project>

### 13.2. Multiple Instances of the Installer

Sometimes users accidentally launch multiple instances of the installer. In most cases this is not an issue, but if this is an issue for you, you can prevent users from launching the installer multiple times by enabling the `<singleInstanceCheck>` project property:

      <project>
        ...
        <singleInstanceCheck>1</singleInstanceCheck>
        ...
      </project>

If the installer is launched a second time while it is still running, it will display a pop-up dialog asking whether or not to continue with the installation.

If you want to prevent more than one instance of the installer from running without giving the choice to the user, you could use the `<singleInstanceCheck>` rule and throw an error:

    <preInstallationActionList>
      <throwError>
         <text>Another instance is running. This instance will abort</text>
         <ruleList>
             <singleInstanceCheck logic="is_running" />
         </ruleList>
      </throwError>
    </preInstallationActionList>

12. Installer Customization |  | 14. Uninstaller