I have an app name foo.app
I want to open from command line (using open
).
My folder structure is like this:
~
+---bar
+--- foo.app
+---baz
+--- foo.app
I want to open the app located in the bar
folder, however if I do open -a foo.app
, the app located in the baz
folder will open, even if my current working directory is in the bar
folder.
open -a ./foo.app
or open -a ~/bar/foo.app
doesn't work either.
Best Answer
In this case,
open -a
is NOT what you want; the-a
option is for launching known applications (indexed in the Launch Services database that lets you open a document and get the right application) by name, not by pathname, or for opening files with a given application.What you are looking for is just plain opening
foo.app
, just like you double-clicked it in the Finder. To do that,This will open exactly that application, without involving the Launch Services database at all.