Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Deployment on OSX
Qt 6.11 is out! See what's new in the release blog

Deployment on OSX

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drewpotter
    wrote on last edited by drewpotter
    #1

    Hello,

    I have an App which runs fine on Android, Windows and OSX.

    However, when I try to deploy the App on OSX on a machine without Qt installed and follow the Qt OSX Deployment guide to do this, my App does not run.

    I have run the following commands as found in the Qt OSX Deployment howto:

    1. Copy the frameworks into the App folder:

    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtGui.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtNetwork.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtQml.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtQuick.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
    cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtWidgets.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks

    1. The -id mode is for libraries and frameworks, and allows us to specify a new identification name:

    install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore

    install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui

    install_name_tool -id @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork

    install_name_tool -id @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtQml.framework/Versions/5/QtQml

    install_name_tool -id @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtQuick.framework/Versions/5/QtQuick

    install_name_tool -id @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets

    1. We use the -change mode to change the paths in the application:

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtQml.framework/Versions/5/QtQml @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtQuick.framework/Versions/5/QtQuick @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool

    install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Mate, just use macdeployqt tool... it will do all this automatically for you. Link to more info.

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        drewpotter
        wrote on last edited by
        #3

        @sierdzio thanks for that! I have used macdeployqt and it has put the frameworks and the plugins inside the App folder.

        However, when I run the App after running macdeployqt it does not load up anymore.

        I wonder what is the problem here?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Try running it from the console, maybe it will print some useful error message. Or, if the standard OS X crash report pops up, open the report and it will likely show you where the problem is.

          (Z(:^

          1 Reply Last reply
          0
          • D Offline
            D Offline
            drewpotter
            wrote on last edited by
            #5

            Thanks, I tried running it from the console, running:

            open -a YateleySchool.app

            And there is no output. Perhaps I am doing the wrong thing here? Maybe there is a different command?

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Yes, try this instead:

              ./YateleySchool.app/Contents/MacOS/yourappname
              

              Does any application window show up (blank, for example)?

              (Z(:^

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                Also, please check the output of otool -L command.

                (Z(:^

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  drewpotter
                  wrote on last edited by
                  #8

                  I tried this and nothing appears. The icon appears in the OSX Dock but no application window appears.

                  Here is the output:

                  viss-imac:YateleySchool adminmac$ /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
                  QQmlApplicationEngine failed to load component
                  qrc:/main.qml:8 module "QtQuick" plugin "qtquick2plugin" not found

                  And here is otool -L

                  viss-imac:YateleySchool adminmac$ otool -L /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
                  /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool:
                  @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.4.0, current version 5.4.1)
                  @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.1)
                  @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.1)
                  /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
                  /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
                  @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.4.0, current version 5.4.1)
                  @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.4.0, current version 5.4.1)
                  @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.4.0, current version 5.4.1)
                  /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
                  /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
                  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
                  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
                  viss-imac:YateleySchool-Android adminmac$

                  1 Reply Last reply
                  0
                  • shavS Offline
                    shavS Offline
                    shav
                    wrote on last edited by
                    #9

                    @drewpotter said:

                    tquick2plugin" not found

                    Hi,

                    I think the problem is macdeployqt doesn't upload any QML plugins/libraries. To fix this you need execute macdeployqt with parameter -qmldir. And set path to your application QML files.

                    Mac OS and iOS Developer

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      Otool looks correct. The thing to blame is 'module "QtQuick" plugin "qtquick2plugin" not found'

                      I think you can instruct macdeployqt tool to include QML stuff using -qmldir=<path> but you would have to Google it to get a concrete answer: I haven't used a Mac in a long time and I don't remember the details.

                      (Z(:^

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved