OS X: Possible to start .app from command line?

icarus4586

Senior member
Jun 10, 2004
219
0
0
Most Mac OS X programs are distributed as ".app" packages, which are basically directories with the required binaries and resources for the program. You run them by simply clicking on the ".app" directory (which doesn't look like a directory unless you're at a terminal).
At any rate, I'm wondering if it's possible to start one of these .app programs from a command line. I've got X11 forwarding enabled, so for normal Unix applications (like emacs, kate, etc) I can connect with SSH from a Unix box and run them on my Mac at home, with full GUI. It would be nice to be able to do that with the .app programs that run in X11, too, but I can't figure out how.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
I think you use the open command. Maybe something like open /Applications/Mail.app

I haven't really tried it though.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Yep, that appears to work, although I certainly haven't tested with x11 forwarding. Nice tip though. I think I'll be using open for a bunch of stuff now :)

You can also go into the .app folder, find the executable and run that, although that's just extra work :p
 

icarus4586

Senior member
Jun 10, 2004
219
0
0
Thanks for the replies, and sorry I've taken so long to reply. School is pretty hectic around now.

Anyway, open does work, and it's a very handy utility. Unfortunately, it looks like when you run the program as an "app," it's unaware of any kind of X11 forwarding. For that, you have to dig through the package and run the binary directly. Thanks for the info!
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
It probably wouldn't be too hard to whip up a shell script to replace open, which digs into the .app folder, finds the executable and runs it. The executables seem to be in a consistent location.