Deploying on MacOS with QtIFW

  • Hello everyone.

    I find myself in the situation that I want to deploy my code for Win, Linux and Mac. I would like to use the QtInstallerframework for this, since it became public use and QT itself uses it to deploy itself. But i'm a bit of a loss here.

    What is working properly:

    • I think I got the App-Bundle set up correctly
    • the seems to create all neccessary files correctly too
    • I managed to create all shortcuts with Windows as OS

    The problem comes with the desktop short cut and /or finder/launchpad entry for macOS.

    The Docu shows only how to do it for Windows and online I've found mostly windows references as well as some linux tips- mostly from this forum :-)

    If I understand this correctly I'll have to modify only the installerscript for this
    Here is what I have:

    function Component()
         if (systemInfo.productType === "windows") { 
            var programFiles = installer.environmentVariable("ProgramFiles");
            if (programFiles != "")
                 installer.setValue("TargetDir", programFiles + "/companyName/AppName");
        if (systemInfo.productType === "mac") {
           var programFiles = installer.environmentVariable("TargetDir");
            if (programFiles != "")
                 installer.setValue("TargetDir", programFiles + "/companyName/AppName");
    Component.prototype.isDefault = function()
        // select the component by default
        return true;
    Component.prototype.createOperations = function()
        try {
            // call the base create operations function
        } catch (e) {
        if (systemInfo.productType === "windows") { 
           component.addOperation("CreateShortcut", "@TargetDir@/AppName.exe", "@StartMenuDir@/AppName.lnk", "workingDirectory=@TargetDir@");
    	component.addOperation("CreateShortcut", "@TargetDir@/AppName.exe", "@HomeDir@/Desktop/uConfig.lnk");
        if (systemInfo.productType === "mac") {
            component.addOperation("CreateShortcut", "@TargetDir@/companyName/AppName/", "@HomeDir@/Desktop/AppName");

    Obviously this does not result in a Dekstop - Link/Alias and I wouldn't know how to add an entry to the launchpad too. Hopefully someone can help me out here.

    Is that even possible with QtIFW? Because I had to create a desktop shortcut under mac manually after installing QtCreator.

  • So, I managed to answer my own question. Took me longer than I'll like to admit, but I'll share my workaround here, in case someone else has this problem:

    If you use apples osascript one can use a shell command to create a desktop alias.

    With that in mind I created a bash skript

    osascript <<END_SCRIPT
    tell application "Finder" to make alias file to file (posix file "$1") at desktop

    That gets added to the app-bundle with the following code in the *.pro-file

       App_Data.files = /path/to/script/
       App_Data.path= Contents/MacOS/data
       QMAKE_Bundle_Data += App_Data

    the installscript.qs of the InstallerFramework, gets the following addition to execute the script:

    var argList = ["@TargetDir@/", "@TargetDir@/"];

    and done.
    In the end, quite easy ....

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.