- Qt 6.11
- Getting Started with Qt
- Get and Install Qt
- Get and Install Qt with Command Line Interface
- Qt 6.11.0 Reference Documentation

Get and Install Qt with Qt Online Installer ◦ Building Qt Sources

# Get and Install Qt with Command Line Interface

Use the command line interface with Qt Online Installer and Qt Maintenance Tool to install, uninstall, update, and search components.

The command line interface supports both interactive and non-interactive usage (unattended usage). The following topics provide examples and information on how you can use the command line interface:

- Downloading Qt Online Installer with Command Line Interface
- Component Names For Installation
- Installing Without User Interaction
- Installing With User Interaction
- Uninstalling Packages
- Listing Installed Packages
- Checking Updates
- Updating Packages
- Popular Commands
- Selecting Mirror for Opensource
- Summary of Command Line Interface Usage

## Downloading Qt Online Installer with Command Line Interface

You can use the `curl` command on the command line interface to download Qt Online Installer. To see all the Qt Online Installer packages available for different platforms, visit Qt Online Installer official releases.

To download a specific Qt Online Installer package with the same name as the remote file, use the `-O` (uppercase 'O') option.

The example command below downloads the `qt-online-installer-linux-x64-online.run` package:

     curl -O https://download.qt.io/official_releases/online_installers/qt-online-installer-linux-x64-online.run

## Component Names for Installation

### Quick Installation with Alias Packages

Instead of searching for specific package names for installation, you can use alias packages to install the most common configurations. Alias packages are a shortcut to include the actual packages for an easier installation experience.

#### Listing Existing Alias Packages

To list the existing alias packages, use the following command on the command line interface.

Using Qt Online Installer:

     <installer executable> search

For details on the Qt Online Installer executables for different platforms, see Installing With User Interaction.

Using Qt Maintenance Tool:

     <maintenancetool executable> search

For details on the Qt Maintenance Tool executables for different platforms, see Installing With User Interaction.

#### Contents of Alias Packages

The contents of the alias packages are listed in the table below.

Note: Qt 6.11.0 release is used in the alias package examples listed below. Always remember to use the packages that match the Qt release you are working on.

Alias package name | Qt Online Installer (package content)
--- | ---
qt6.11.0-essentials | essential module libraries essential module headers essential module private headers essential module runtime tools essential module development tools
qt6.11.0-essentials-dev | essential module libraries essential module headers essential module private headers essential module runtime tools essential module development tools
qt6.11.0-full | essential module libraries essential module headers essential module private headers essential module runtime tools essential module development tools add-on module libraries add-on module headers add-on module private headers add-on module runtime tools add-on module development tools sources
qt6.11.0-full-dev | essential module libraries essential module headers essential module private headers essential module runtime tools essential module development tools add-on module libraries add-on module headers add-on module private headers add-on module runtime tools add-on module development tools sources
qt6.11.0-full-dbg | Qt debug information files for: essential module libraries add-on module libraries
qt6.11.0-sdk | latest Qt Creator qt6.11.0-full-dev (details above) qt6.11.0-full-dbg (details above) Ninja CMake

Qt Online Installer command examples

     # Windows: new installation with Qt Online Installer
     qt-unified-windows-x64-[Qt Online Installer version]-online.exe install qt6.11.0-sdk

     # macOS: new installation with Qt Online Installer
     hdiutil attach qt-unified-macOS-x64-[Qt Online Installer version]-online.dmg
     /Volumes/qt-unified-macOS-x64-[Qt Online Installer version]-online/qt-unified-macOS-x64-[Qt Online Installer version]-online.app/Contents/MacOS/qt-unified-macOS-x64-[Qt Online Installer version]-online install qt6.11.0-sdk
     hdiutil detach /Volumes/qt-unified-macOS-x64-[Qt Online Installer version]-online

     # Linux: new installation with Qt Online Installer
     qt-unified-linux-x64-[Qt Online Installer version]-online.run install qt6.11.0-sdk

#### Alias Package Options for Windows

Note: The information in this section is valid for the Qt 6.8, Qt 6.9, and Qt 6.10 releases.

Windows on ARM64

Only the MSVC binaries (msvc2022-arm64) are installed as other Qt binary packages are not available for Windows on Arm (WoA).

Windows on x86_64

By default, only the MinGW binaries are installed.

However, with Windows on x86_64 you can also install binaries for the following toolchains.

- llvm-mingw
- msvc2022
- msvc2022-arm64 (for cross-compilation)

Using, for example, the qt6.11.0-essentials alias package installs the package with the default MinGW binaries.

To get the `Qt essentials` package content with, for example, the MSVC 2022 binaries, use the corresponding qt6.11.0-msvc2022-essentials alias package.

### Listing Non-Alias Packages

To list the non-alias packages, use the following command on the command line interface.

Using Qt Online Installer:

     <installer executable> search --type package

For details on the Qt Online Installer executables for different platforms, see Installing With User Interaction.

Using Qt Maintenance Tool:

     <maintenancetool executable> search --type package

For details on the Qt Maintenance Tool executables for different platforms, see Installing With User Interaction.

### Advanced Searching for Specific Installation Packages

Search available packages with the `search` command and regular expressions: `search <regexp>`. You can filter the results with `--filter-packages <regexp>`. For example, filtering with the display name information can help search.

For example, the following command finds all MSVC 2022 packages for Qt 6.11.0:

     search .*6110.*msvc2022

You get the same result when you filter the search result as follows:

     search --filter-packages DisplayName=MSVC 2022,Version=6.11.0

As a result, you get the following packages:

     <availablepackages>
         <package name="qt.qt6.6110.win64_msvc2022_64" displayname="MSVC 2022 64-bit" version="6.11.0.-0-<timestamp>"/>
         <package name="qt.qt6.6110.win64_msvc2022_arm64" displayname="MSVC 2022 ARM64" version="6.11.0.-0-<timestamp>"/>
     </availablepackages>

You can also use filtering when you search all Qt versions that some package is provided for. For example, search all Qt Charts packages provided for Qt versions:

     search --filter-packages DisplayName=charts

The search result is as follows:

     <availablepackages>
         <package name="qt.qt5.5125.qtcharts" displayname="Qt Charts" version="5.12.5-0-<timestamp>"/>
         <package name="qt.qt6.641.addons.qtcharts" displayname="Qt Charts" version="6.4.1-0-<timestamp>"/>
         <package name="qt.qt5.5123.qtcharts" displayname="Qt Charts" version="5.12.3-0-<timestamp>"/>

## Installing Without User Interaction

By default, Qt Online Installer or Qt Maintenance Tool may ask for additional information during installation, which requires user attention. Unattended usage via the command line interface is possible by providing all the requested information beforehand with appropriate options.

### New Installation with Qt Online Installer

You can do new installations from the command line interface without user interaction as follows:

1. Define the Qt Online Installer executable.
2. Define the installation directory with `--root`.
3. Use the `install <list of packages>` command with options for unattended usage. See the full list of options in Options for Unattended Usage.

The following examples demonstrate how you install Qt 6.11.0 binaries with Qt Online Installer for Windows, macOS, and Linux. The unattended commands automatically accept the licenses (`--accept-licenses`), answer all message queries with their default answer (`--default-answer`), and skip asking for permission to continue performing (`--confirm-command`):

     # Windows: new installation with Qt Online Installer
     qt-unified-windows-x64-[Qt Online Installer version]-online.exe --root C:\Users\[username]\installation_dir --accept-licenses --default-answer --confirm-command install qt.qt6.6110.win64_msvc2022_64

     # macOS: new installation with Qt Online Installer
     qt-unified-macOS-x64-[Qt Online Installer version]-online.dmg --root /home/<username>/installation_dir --accept-licenses --default-answer --confirm-command install qt.qt6.6110.clang_644

     # linux: new installation with Qt Online Installer
     qt-unified-linux-x64-[Qt Online Installer version]-online.run --root /home/<username>/installation_dir --accept-licenses --default-answer --confirm-command install qt.qt6.6110.linux_gcc_64

Options for Unattended Usage lists all available options for unattended usage.

### Updating Installation with Qt Maintenance Tool

You can update existing installation from the command line interface without user interaction as follows:

1. Define the Qt Maintenance Tool executable.
2. Use `install <list of packages>` with options for unattended usage. See the full list of options in Options for Unattended Usage.

The following examples demonstrate how you add Qt 6.11.0 binaries with Qt Maintenance Tool to an exsting installation on Windows, macOS, and Linux. The unattended commands automatically accept the licenses (`--accept-licenses`), answer all message queries with their default answer (`--default-answer`), and skip asking for permission to continue performing (`--confirm-command`):

     # Windows: update installation with Qt Maintenance Tool
     MaintenanceTool.exe --accept-licenses --default-answer --confirm-command install qt.qt6.6110.win64_msvc2022_64

     # macOS: update installation with Qt Maintenance Tool
     MaintenanceTool.app/Contents/MacOS/MaintenanceTool --accept-licenses --default-answer --confirm-command install qt.qt6.6110.clang_64

     # linux: update installation with Qt Maintenance Tool
     MaintenanceTool.run --accept-licenses --default-answer --confirm-command install qt.qt6.6110.linux_gcc_64

### Options for Unattended Usage

The following table lists all options for unattended command line usage:

Option for unattended usage | Description
--- | ---
`--accept-licenses` | Automatically accepts all license agreements.
`--accept-obligations` | In the opensource installations, accepts Qt Open Source usage obligations without user input.
`--default-answer` | Answers all message queries with their default answer.
`--auto-answer <identifier=value>` | In case you want different answers to certain queries, you can use this option. For example, `--auto-answer telemetry-question=Yes,AssociateCommonFiletypes=Yes`. See all message identifiers in Message Identifiers for --auto-answer.
`--accept-messages` | Accepts all message queries.
`--reject-messages` | Rejects all message queries.
`--confirm-command` | By default, Qt Online Installer and Qt Maintenance Tool print a summary of components to be affected by the option. Then they ask for permission to continue acting, to prevent accidental changes. This option skips asking for permission to continue.
`--email <your_email>` | Provides the email when you log in from the command line. For more information, see Providing Login Information.
`--pw <your_pw>` | Provides the password when you log in from the command line. For more information, see Providing Login Information.
`--file-query <identifier=value>` | Sometimes Qt Online Installer asks for a file or a folder location. You can provide the location with `--file-query <identifier=value>`. For example, `--file-query PathForSDP7=<path_to_sdp>`. The identifiers are printed into the command line before the actual question and message type. You can pick up the identifiers from there.

### Message Identifiers for --auto-answer

Use the `--auto-answer` option to provide answers to certain queries. The following table lists known identifiers and values used for `--auto-answer`:

ID | Values | Default
--- | --- | ---
OperationDoesNotExistError | Abort, Ignore | Ignore
OverwriteTargetDirectory | Yes, No | No
stopProcessesForUpdates | Retry, Ignore, Cancel | Cancel
installationErrorWithCancel | Retry, Ignore, Cancel | Cancel
installationErrorWithIgnore | Retry, Ignore | Ignore
AssociateCommonFiletypes | Yes, No | Yes
telemetry-question | Yes, No | Yes

### Providing Login Information

Qt Online Installer and Qt Maintenance Tool have a forced login. The forced login uses information on the qtaccount.ini file if it is available in cache. You find qtaccount.ini as follows:

Host | qtaccount.ini location
--- | ---
Windows | `C:\Users\<username>\AppData\Roaming\Qt`
macOS | `/Users/<username>/Library/Application Support/Qt/qtaccount.ini`
Linux | `/home/<username>/.local/share/Qt/qtaccount.ini`

Optionally, you can login either from the command line using the switches for email and password: `--email <your_email>` and `--pw <your_pw>`.

Alternatively, you can save the jwt token to the environment variable `QT_INSTALLER_JWT_TOKEN`. You find the token in the qtaccount.ini file.

## Installing With User Interaction

You can use the command line interface with user interaction as follows:

1. Define the executable:
   - Qt Online Installer if you need to do a new installation.
   - Qt Maintenance Tool if you need to update an existing installation.
2. When you do a new installation, define the installation directory with `--root`
3. Use `install <list of packages>` to install the listed packages.

The following examples demonstrate how you create a new installation of Qt 6.11.0 binaries with Qt Online Installer for Windows, macOS, and Linux:

     # Windows: new installation with user interaction
     qt-unified-windows-x64-[Qt Online Installer version]-online.exe --root C:\Users\[username]\installation_dir install qt.qt6.6110.win64_msvc2022_64

     # macOS: new installation with user interaction
     qt-unified-macOS-x64-[Qt Online Installer version]-online.dmg --root /home/<username>/installation_dir install qt.qt6.6110.clang_64

     # linux: new installation with user interaction
     qt-unified-linux-x64-[Qt Online Installer version]-online.run --root /home/<username>/installation_dir install qt.qt6.6110.linux_gcc_64

The following examples demonstrate how you update your existing installation by installing the Qt 6.11.0 binaries with Qt Maintenance Tool:

     # Windows: update installation with Qt Maintenance Tool
     MaintenanceTool.exe install qt.qt6.6110.win64_msvc2022_64

     # macOS: update installation with Qt Maintenance Tool
     MaintenanceTool.dmg install qt.qt6.6110.clang_64

     # Linux: update installation with Qt Maintenance Tool
     MaintenanceTool.run install qt.qt6.6110.linux_gcc_64

## Uninstalling Packages

The command line interface provides two commands for uninstalling packages:

- The `remove <list of packages>` command uninstalls the listed packages.
- The `purge` command uninstalls all installed packages.

You should use both commands with Qt Maintenance Tool.

By default, Qt Maintenance Tool prints a summary of components to be affected by the command. Then the tool asks for permission to continue acting, to prevent accidental changes. Use `--confirm-command` to skip asking for permission to continue.

The following example uninstalls the Qt 6.11.0 binaries without user interaction:

     # windows
     MaintenanceTool.exe --confirm-command remove qt.qt6.6110.win64_msvc2022_64

     # macOS
     MaintenanceTool.dmg --confirm-command remove install qt.qt6.6110.clang_64

     # linux
     MaintenanceTool.run --confirm-command remove qt.qt6.6110.linux_gcc_64

The following examples uninstall all packages and ask for permission to continue performing the action:

     # Windows
     MaintenanceTool.exe purge

     # macOS
     MaintenanceTool.dmg purge

     # Linux
     MaintenanceTool.run purge

## Listing Installed Packages

The `list` command lists all packages you have installed. Use the command with Qt Maintenance Tool as follows:

     # Windows
     MaintenanceTool.exe list

     # macOS
     MaintenanceTool.dmg list

     # Linux
     MaintenanceTool.run list

## Checking Updates

The `check-updates` command checks the updates that are available for the installed packages. Use the command with Qt Maintenance Tool as follows:

     # Windows
     MaintenanceTool.exe check-updates

     # macOS
     MaintenanceTool.dmg check-updates

     # Linux
     MaintenanceTool.run check-updates

## Updating Packages

The `update` command updates the installed packages. Use the command with Qt Maintenance Tool as follows:

     # windows
     MaintenanceTool.exe update

     # macOS
     MaintenanceTool.dmg update

     # linux
     MaintenanceTool.run update

## Popular Commands

Use the command `<installer_executable> --help` to study the available commands and options. Popular commands are as follows:

Command | Usage
--- | ---
`in`, `install <pkg ...>` | Installs packages given as an argument. If you don't give any packages, installs the default package set.
`rm`, `remove <pkg ...>` | Uninstalls selected packages and their child components.
`ch`, `check-updates` | Shows information about available updates on Qt Maintenance Tool.
`up`, `update <pkg ...>` | Updates packages given as an argument. If no packages are given, install all available updates.
`se`, `search <regexp>` | Searches available packages. If you don't give any search pattern, shows all available packages. You can use the `--filter-packages` option to specify additional filters for the search operation. See Summary of Options in Qt Installer Framework Manual.

Qt Installer Framework Manual provides more information about the commands and options.

## Selecting Mirror for Opensource

Qt Online Installer has an option for selecting a mirror for opensource metadata and downloads. Set the mirror from the command line with the `--mirror` option.

For example, use `--mirror` as follows:

     installer(.exe) --mirror http://www.nic.funet.fi/pub/mirrors/download.qt-project.org
     installer(.exe) --mirror http://ftp2.nluug.nl/languages/qt
     maintenancetool(.exe) --mirror http://qt.mirror.constant.com

As the example shows, don't use the full path but use the path before '/online' (no forward slash at the end).

You find the available mirrors from https://download.qt.io/online/qtsdkrepository/windows_x86/root/qt/Updates.xml.mirrorlist.

## Summary of Command Line Interface Usage

Qt Installer Framework Manual provides more detailed information about the command line interface:

- Using from Command Line describes different command line interface use cases.
- Summary of Options lists all available options.
- Summary of Commands lists all available commands.

Get and Install Qt with Qt Online Installer ◦ Building Qt Sources