Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to allow open two or more instances of an application?



  • Hi!

    I have an application written with Qt Creator 4.6.1 (Based on Qt 5.10.1).
    When I have this application launched and make another double click on the application icon, the first instance (which is already launched) shows.
    Is it possible to set some flags or do something and be able to open another instance?

    Thanks a lot!
    Serge



  • @Mufan
    Normally each launch would create a separate instance (try it in a simple app test). Does the code already have something which prevents that? Google for qt application multiple instances and you'll see people discussing what might be done to prevent them.


  • Lifetime Qt Champion

    Hi,

    What platform are you running on ?



  • @SGaist
    Hi! I'm running on MacOS.

    @JonB
    I don't use "lock unique files" or QSystemSemaphore methods to prevent this. That should be something else.



  • On Mac, the Finder doesn't allow users to launch multiple instances of the same app.

    Work around:

    • Duplicate the app with a different name.
    • With the Terminal, use open command with the path of the executable in the app bundle folder, like that:
      open AppName.app/Contents/MacOS/AppName

Log in to reply