Sample Header Ad - 728x90

'open -a' opens a new instance

3 votes
2 answers
167 views
In my apple script, I use do shell script to call the command open -a "MyApp". Normally, when the application MyApp is already open, its main window gets focused instead of opening a new instance. However, on one of my machines the behaviour is different depending on how I opened the first instance: - If I open MyApp using the launchpad, then call open -a "MyApp", a new instance of MyApp is opened. - If I open MyApp using open -a "MyApp", then subsequent calls to open -a "MyApp" focus the main window of the already open instance. EDIT: After some search, I found two instances of MyApp. One in homebrew (which the launcher does not see for some reason) and one in $HOME/Applications which I copied for the launcher. In particular, when I run
osascript -e 'POSIX path of (path to application "MyApp")'
I get /opt/homebrew/Cellar/myapp-1.0.0/MyApp.app/ When I launch MyApp in the launcher, the application that is opened is the copy in $HOME/Application, while when I call open -a "MyApp", the one in /opt/homebrew gets openned. So now the questions is, where is path to application "MyApp" getting the path from? How do I deregister such an app?
Asked by Tohiko (191 rep)
Aug 2, 2024, 08:23 AM
Last activity: Aug 5, 2024, 06:58 PM