Important: Please read the Qt Code of Conduct -

Self contained macOS app with custom libraries (macdeployqt)

  • Good morning,
    I need advice regarding macdeployqt.

    Following the documentation and using otool with macdeployqt works just fine, however I am somehow puzzled as to where in the package should I put my own dynamic libraries?

    I have a subdir project structured inside more or less like this:

    • app1
    • app2
    • lib1
    • lib2
    • app3

    app3 depends on lib1 and lib2, app2 on lib1 only, app1 on lib2 only, so for the simplicity all the libs are built into one folder - the build tree of the project contains respectively:

    • app1
    • app2
    • app3
    • shared

    All the libs are in the shared folder. On Windows I don't even bother, the installer creates shared folder, programs find there their libs, all is golden. On Mac, however, I've decided to go with the self contained approach - what would be solution here?

    Can post my .pro files if some adjustments need to be made.
    Thank you in advance.

  • Moderators

    Do you want all 3 apps to reside inside your .app package? Or you want 3 separate .apps?

    If the former - then it's up to you. People tend to put all libs in the same directory where executable is - .app/Contents/MacOS. If the latter - run macdeployqt 3 times, once for each app. You will get 3 .app packages, all containing (duplicated) libraries.

  • Lifetime Qt Champion


    One thing to take into account, there are guidelines with regards to what out where in an app bundle. Depending on the way you are going to distribute it, this is important.

  • @sierdzio three separate ones. Use pattern is that most of the users will have only one, two others are the matter of one's choice.
    @SGaist this is internal tool to be distributed locally only. So I thought of three separate self contained apps distributed on one .dmg - I think it does not violate anything? To clarify - none of this is intended for AppStore or any other kind of public distribution.

  • Moderators

    Then 3 separate .apps is probably the easiest course of action. They can be sewn into a single DMG using many tools available commercially. I've never used them so I can't really recommend a specific one.

  • @sierdzio Thank you for all the info, I think I'll be able to take things on from here.

    Have a lovely day :)

Log in to reply