Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to make a standalone macOS application to share with others
Forum Updated to NodeBB v4.3 + New Features

How to make a standalone macOS application to share with others

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
12 Posts 4 Posters 1.1k 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.
  • A Offline
    A Offline
    abra
    wrote on last edited by
    #1

    Hi,

    I'm trying to make my macOS application into a standalone image that I can share with others.
    The application called NoBlue is running fine on my Mac (Air 15, M2), but when I run macdeployqt and share it with others, it crashes immediately!

    I simply run:

    macdeployqt "NoBlue.app" -verbose 3
    

    I'm running macOS Ventura 13.4
    I've also attached my CMakeList file, perhaps something is wrongly configured there....

    Screenshot 2023-09-07 at 13.48.41.png

    Screenshot 2023-09-07 at 13.44.17.png

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

      @abra Most probably your app crashes for others because it has a local code signature. macOS arm binaries you want to distribute to others require a valid code signature.
      If you look into the crash report on the other machine's console app you should see something like cause: Code Signature invalid.
      You have to sign the app with a paid apple developer id.
      Otherwise you could execute there codesign -s - --deep <MyApp>.app to give the app a local valid signature. If it runs then the signature is your problem.

      1 Reply Last reply
      2
      • A abra

        Hi,

        I'm trying to make my macOS application into a standalone image that I can share with others.
        The application called NoBlue is running fine on my Mac (Air 15, M2), but when I run macdeployqt and share it with others, it crashes immediately!

        I simply run:

        macdeployqt "NoBlue.app" -verbose 3
        

        I'm running macOS Ventura 13.4
        I've also attached my CMakeList file, perhaps something is wrongly configured there....

        Screenshot 2023-09-07 at 13.48.41.png

        Screenshot 2023-09-07 at 13.44.17.png

        sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        @abra which Qt version are you using?

        Are you using the universal binary, arm or x86 architectures?

        (Z(:^

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #3

          Hi,

          Beside the good questions of @sierdzio, you should not hardcode the .plist location like that. CMake knows where the sources are so you can use a relative path or a path built from the current directory.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Beside the good questions of @sierdzio, you should not hardcode the .plist location like that. CMake knows where the sources are so you can use a relative path or a path built from the current directory.

            A Offline
            A Offline
            abra
            wrote on last edited by
            #4

            @SGaist yes I know Info.plist should have the relative path, I've just been trying all kind of things trying to build this self contained app.

            I'm using Qt 6.5.2 and building for arm. Again, the resulting application after running macdeployqt runs fine on my mac. Am I somehow not linking in everything statically, since it crashes on machines without Qt installed...?

            sierdzioS 1 Reply Last reply
            0
            • A abra

              @SGaist yes I know Info.plist should have the relative path, I've just been trying all kind of things trying to build this self contained app.

              I'm using Qt 6.5.2 and building for arm. Again, the resulting application after running macdeployqt runs fine on my mac. Am I somehow not linking in everything statically, since it crashes on machines without Qt installed...?

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #5

              Hm, Qt 6.5 should handle this nicely. Things to try:

              • install & use the x86 build of Qt, then it should work on both ARM and Intel macs
              • try your current universal build (I assume you have an universal build since Qt does not ship a prebuilt ARM-only builds) with CMAKE_OSX_ARCHITECTURES set, see https://doc.qt.io/qt-6/macos.html#architectures

              (Z(:^

              A 1 Reply Last reply
              0
              • sierdzioS sierdzio

                Hm, Qt 6.5 should handle this nicely. Things to try:

                • install & use the x86 build of Qt, then it should work on both ARM and Intel macs
                • try your current universal build (I assume you have an universal build since Qt does not ship a prebuilt ARM-only builds) with CMAKE_OSX_ARCHITECTURES set, see https://doc.qt.io/qt-6/macos.html#architectures
                A Offline
                A Offline
                abra
                wrote on last edited by
                #6

                @sierdzio ok, will try, like this then..? Screenshot 2023-09-08 at 08.24.58.png

                sierdzioS 1 Reply Last reply
                0
                • A abra

                  @sierdzio ok, will try, like this then..? Screenshot 2023-09-08 at 08.24.58.png

                  sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #7

                  @abra I'd just put it in your cmake code, but here it should also work, yes.

                  (Z(:^

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

                    @abra Most probably your app crashes for others because it has a local code signature. macOS arm binaries you want to distribute to others require a valid code signature.
                    If you look into the crash report on the other machine's console app you should see something like cause: Code Signature invalid.
                    You have to sign the app with a paid apple developer id.
                    Otherwise you could execute there codesign -s - --deep <MyApp>.app to give the app a local valid signature. If it runs then the signature is your problem.

                    1 Reply Last reply
                    2
                    • D Offline
                      D Offline
                      DerReisende
                      wrote on last edited by
                      #9

                      Also you can use otool -L <AppName.app/Contents/MacOS/<binary> to check if all dylibs your app needs are properly stored in your qt mac deployed binary or if your app has references to locally referenced libs (e.g. homebrew installed) that may become a problem as well.

                      A 1 Reply Last reply
                      0
                      • D DerReisende

                        Also you can use otool -L <AppName.app/Contents/MacOS/<binary> to check if all dylibs your app needs are properly stored in your qt mac deployed binary or if your app has references to locally referenced libs (e.g. homebrew installed) that may become a problem as well.

                        A Offline
                        A Offline
                        abra
                        wrote on last edited by
                        #10

                        @DerReisende Thanks a lot, very helpful, will try this Monday and let you know how I go...

                        D 1 Reply Last reply
                        0
                        • A abra

                          @DerReisende Thanks a lot, very helpful, will try this Monday and let you know how I go...

                          D Offline
                          D Offline
                          DerReisende
                          wrote on last edited by
                          #11

                          @abra did you find a solution or more insight?

                          A 1 Reply Last reply
                          0
                          • D DerReisende

                            @abra did you find a solution or more insight?

                            A Offline
                            A Offline
                            abra
                            wrote on last edited by
                            #12

                            @DerReisende sorry for the late reply.
                            Yes the problem was the signing, once I run codesign -s - --deep <MyApp>.app after macdeployqt, the app runs just fine on another mac.

                            Thanks again!

                            1 Reply Last reply
                            1
                            • SGaistS SGaist has marked this topic as solved on

                            • Login

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