'How to run a gui problem as user without 'open' with 'launchctl asuser`?

I ran like this.

launchctl asusr 501 /Application/My.app/Contents/MacOS/gui_program --args

It can be displayed under the user's context, but the program itself is ran as root role with high priviledge, this is dangerous.

Another way is to run like this.

launchctl asusr 501 open -n -a /Application/My.app --args

in this way, the program is ran under the user role. But it prohibits users opening anothe My.app from the Finder because my app is not a multiple-windows app.

Is there any other way to run /Application/My.app/Contents/MacOS/gui_program under the user context and avoiding above problems?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source