How to make a standalone macOS application to share with others
-
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.@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...?
-
@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...?
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
-
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
-
@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 therecodesign -s - --deep <MyApp>.app
to give the app a local valid signature. If it runs then the signature is your problem. -
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. -
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.@DerReisende Thanks a lot, very helpful, will try this Monday and let you know how I go...
-
@DerReisende Thanks a lot, very helpful, will try this Monday and let you know how I go...
@abra did you find a solution or more insight?
-
@abra did you find a solution or more insight?
@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!
-
S SGaist has marked this topic as solved on