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.3k 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 7 Sept 2023, 11:49 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

    S 1 Reply Last reply 7 Sept 2023, 11:51
    0
    • D Offline
      D Offline
      DerReisende
      wrote on 8 Sept 2023, 06:54 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
        7 Sept 2023, 11:49

        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

        S Offline
        S Offline
        sierdzio
        Moderators
        wrote on 7 Sept 2023, 11:51 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 7 Sept 2023, 19:24 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 8 Sept 2023, 06:02
          0
          • S SGaist
            7 Sept 2023, 19:24

            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 8 Sept 2023, 06:02 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...?

            S 1 Reply Last reply 8 Sept 2023, 06:13
            0
            • A abra
              8 Sept 2023, 06:02

              @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...?

              S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 8 Sept 2023, 06:13 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 8 Sept 2023, 06:25
              0
              • S sierdzio
                8 Sept 2023, 06:13

                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 8 Sept 2023, 06:25 last edited by
                #6

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

                S 1 Reply Last reply 8 Sept 2023, 06:30
                0
                • A abra
                  8 Sept 2023, 06:25

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

                  S Offline
                  S Offline
                  sierdzio
                  Moderators
                  wrote on 8 Sept 2023, 06:30 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 8 Sept 2023, 06:54 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 8 Sept 2023, 07:00 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 9 Sept 2023, 09:51
                      0
                      • D DerReisende
                        8 Sept 2023, 07:00

                        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 9 Sept 2023, 09:51 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 15 Sept 2023, 18:17
                        0
                        • A abra
                          9 Sept 2023, 09:51

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

                          D Offline
                          D Offline
                          DerReisende
                          wrote on 15 Sept 2023, 18:17 last edited by
                          #11

                          @abra did you find a solution or more insight?

                          A 1 Reply Last reply 21 Sept 2023, 18:54
                          0
                          • D DerReisende
                            15 Sept 2023, 18:17

                            @abra did you find a solution or more insight?

                            A Offline
                            A Offline
                            abra
                            wrote on 21 Sept 2023, 18:54 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
                            • S SGaist has marked this topic as solved on 22 Sept 2023, 18:39

                            1/12

                            7 Sept 2023, 11:49

                            • Login

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