Skip to content

CQtDeployer for macOS

CQtDeployer supports macOS (Apple Silicon / ARM64 and Intel / x86_64) as a host and a deploy target.

Platform support

  • Host platforms:

    • Linux
    • Windows
    • macOS (ARM64 and x86_64)
  • Deploy targets:

    • Linux (ELF binaries)
    • Windows (PE binaries)
    • macOS (Mach-O binaries)

Mach-O binaries are parsed with the full file parsing on the LIEF backend, so the dependency scanning (the linked dylibs and the Qt frameworks) works on every host platform. A full deploy of a macOS application requires the qmake of a macOS Qt build, so run the deploy on a macOS host.

Install CQtDeployer on macOS

  • Download the CQtDeployer_*_dmg archive from the releases page.
  • Open the DMG file and move the CQtDeployer.app bundle into the Applications folder.
open CQtDeployer_*.dmg
cp -R /Volumes/CQtDeployer/CQtDeployer.app /Applications/

To run cqtdeployer from the command line, add a symbolic link to the bundle binary:

ln -s /Applications/CQtDeployer.app/Contents/MacOS/CQtDeployer /usr/local/bin/cqtdeployer

Alternatively, you can build cqtdeployer from source - see the Build and Install page (the Build for macOS section).

How to use

Deploy a macOS application

cqtdeployer -bin myApp -qmake /Users/<user>/Qt/6.10.3/macos/bin/qmake

If your application uses QML, add the qmlDir option:

cqtdeployer -bin myApp -qmake /Users/<user>/Qt/6.10.3/macos/bin/qmake -qmlDir /path/to/my/qml/sources

If you use extra libraries, add the libDir option:

cqtdeployer -bin myApp -qmake /Users/<user>/Qt/6.10.3/macos/bin/qmake -libDir /PathToMyExtraLibs -recursiveDepth 5

To create a portable archive of the deployed application, add the zip packager option:

cqtdeployer -bin myApp -qmake /Users/<user>/Qt/6.10.3/macos/bin/qmake -qmlDir /path/to/my/qml/sources zip

To create a distributable DMG package of the deployed application (the standard macOS distribution format: the volume with the ready-to-use application, the application icon, the README file with the package information and the Applications symbolic link of the drag-to-install UX), add the dmg packager option:

cqtdeployer -bin myApp -qmake /Users/<user>/Qt/6.10.3/macos/bin/qmake -qmlDir /path/to/my/qml/sources dmg

The DMG package is created with the hdiutil tool of the macOS system, the name of the volume is the name of the package (the name option), the name of the output file is the dmgOut option (<name>.dmg by default). For more info see the DMG documentation.

How the macOS deployment works

  • CQtDeployer detects the Mach-O binaries (thin and fat binaries are supported) with the full file parsing on the LIEF backend and extracts the linked dylibs and the Qt frameworks.
  • The deployed binaries are not rewritten: the original install names are kept. The generated run script points the macOS dynamic loader to the deployed frameworks and dylibs with the DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH environment variables.
  • The distribution is launched with the generated run script (the same way as on Linux).

Limitations

  • The dmg packager is available only on the macOS hosts (the DMG packages are created with the hdiutil tool of the macOS system), the deb packager only on the Linux hosts and the appimage packager only on the Linux hosts: on the other host platforms the options are skipped with a warning.
  • The Qt Installer Framework (QIF) installer of the macOS hosts is the .app bundle of the binarycreator (issue #738): the QIFW tools are stored in the repository for the macOS platform (issue #867) and the arm64 slice of the staged binaries is code signed, so the Apple Silicon hosts are supported (issue #896).