Home > Back-end >  prevent macOS app from having multiple instances running simultaneously (launch executable file in t
prevent macOS app from having multiple instances running simultaneously (launch executable file in t

Time:01-29

I set LSMultipleInstancesProhibited to YES, but if launch executable file(/Contents/MacOS/) in terminal, the macOS app can be run multiplely. for example: first terminal can run first executable file, second terminal can run second executable file. Please help. Thanks in advance.

CodePudding user response:

You could get the information of your own app and check if there is already running instance in the system. Programmatically check if a process is running on Mac

CodePudding user response:

Running the executable from terminal bypasses LaunchServices. To launch as normally, issue command open -a myapp.app

  • Related