- Get and Install Qt with Command Line Interface
- Installing Without User Interaction
- New Installation with Qt Online Installer
- Updating Installation with Maintenance Tool
- Options for Unattended Usage
- Message Identifiers for –auto-answer
- Providing Login Information
- Installing With User Interaction
- Uninstalling Packages
- Searching Packages
- Listing Installed Packages
- Checking Updates
- Updating Packages
- Popular Commands
- Selecting Mirror for Opensource
- Further Information
Get and Install Qt with Command Line Interface
From Qt Online Installer and Maintenance Tool 4.0 onward, an improved command line interface (CLI) enables installing, uninstalling, updating, and searching components. You can use the command line interface with Qt Online installer and Maintenance Tool.
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:
Installing Without User Interaction
By default, Qt Online installer or 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:
- Define the Qt Online Installer executable.
- Define the installation directory with —root .
- Use the install 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.5.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 ), skip asking for permission to continue performing ( —confirm-command ), and accept all message queries ( accept-messages ):
# 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 --accept-messages install qt.qt6.650.win64_msvc2019_64 # macOS: new installation with Qt Online installer qt-unified-macOS-x64-[Qt Online Installer version]-online.dmg --root /home//installation_dir --accept-licenses --default-answer --confirm-command --accept-messages install qt.qt6.650.clang_644 # linux: new installation with Qt Online installer qt-unified-linux-x64-[Qt Online Installer version]-online.run --root /home//installation_dir --accept-licenses --default-answer --confirm-command --accept-messages install qt.qt6.650.gcc_64
Options for Unattended Usage lists all available options for unattended usage.
Updating Installation with Maintenance Tool
You can update existing installation from the command line interface without user interaction as follows:
- Define the Maintenance Tool executable.
- Use install 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.5.0 binaries with 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 ), skip asking for permission to continue performing ( —confirm-command ), and accept all message queries accept-messages ):
# Windows: update installation with Maintenance Tool MaintenanceTool.exe --accept-licenses --default-answer --confirm-command --accept-messages install qt.qt6.650.win64_msvc2019_64 # macOS: update installation with Maintenance Tool MaintenanceTool.dmg --accept-licenses --default-answer --confirm-command --accept-messages install qt.qt6.650.clang_64 # linux: update installation with Maintenance Tool MaintenanceTool.run --accept-licenses --default-answer --confirm-command --accept-messages install qt.qt6.650.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 | 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 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. |
Provides the email when you log in from the command line. For more information, see Providing Login Information. | |
—pw | Provides the password when you log in from the command line. For more information, see Providing Login Information. |
—file-query | Sometimes the installer asks for a file or a folder location. You can provide the location with —file-query . For example, —file-query PathForSDP7= . |
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 MaintenanceTool 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\\AppData\Roaming\Qt |
macOS | /Users//Library/Application Support/Qt/qtaccount.ini |
Linux | /home//.local/share/Qt/qtaccount.ini |
Optionally, you can login either from the command line using the switches for email and password: —email and —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:
- Define the executable:
- Qt Online Installer if you need to do a new installation.
- Maintenance Tool if you need to update an existing installation.
- When you do a new installation, define the installation directory with —root
- Use install to install the listed packages.
The following examples demonstrate how you create a new installation of Qt 6.5.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.650.win64_msvc2019_64 # macOS: new installation with user interaction qt-unified-macOS-x64-[Qt Online Installer version]-online.dmg --root /home//installation_dir install qt.qt6.650.clang_64 # linux: new installation with user interaction qt-unified-linux-x64-[Qt Online Installer version]-online.run --root /home//installation_dir install qt.qt6.650.gcc_64
The following examples demonstrate how you update your existing installation by installing the Qt 6.5.0 binaries with Maintenance Tool:
# Windows: update installation with Maintenance Tool MaintenanceTool.exe install qt.qt6.650.win64_msvc2019_64 # macOS: update installation with Maintenance Tool MaintenanceTool.dmg install qt.qt6.650.clang_64 # Linux: update installation with Maintenance Tool MaintenanceTool.run install qt.qt6.650.gcc_64
Uninstalling Packages
The command line interface provides two commands for uninstalling packages:
- The remove command uninstalls the listed packages.
- The purge command uninstalls all installed packages.
You should use both commands with Maintenance Tool.
By default, 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.5.0 binaries without user interaction:
# windows MaintenanceTool.exe --confirm-command remove qt.qt6.650.win64_msvc2019_64 # macOS MaintenanceTool.dmg --confirm-command remove install qt.qt6.650.clang_64 # linux MaintenanceTool.run --confirm-command remove qt.qt6.650.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
Searching Packages
Search available packages with the search command and regular expressions: search . You can filter the results with —filter-packages . For example, filtering with the display name information can help search.
For example, the following command finds all MSVC 2019 packages for Qt 6.5.0:
You get the same result when you filter the search result as follows:
search --filter-packages DisplayName=MSVC 2019,Version=6.5.0
As a result, you get the following packages:
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:
Listing Installed Packages
The list command lists all packages you have installed. Use the command with 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 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 Maintenance Tool as follows:
# windows MaintenanceTool.exe update # macOS MaintenanceTool.dmg update # linux MaintenanceTool.run update
Popular Commands
Use the command —help to study the available commands and options. Popular commands are as follows:
Command | Usage |
---|---|
in , install | Installs packages given as an argument. If you don’t give any packages, installs the default package set. |
rm , remove | Uninstalls selected packages and their child components. |
ch , check-updates | Shows information about available updates on Maintenance Tool. |
up , update | Updates packages given as an argument. If no packages are given, install all available updates. |
se , search | 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
The 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).
Further Information
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.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.