# How does one launch an ".app" from a shell script?



## jgc94131 (Jan 9, 2003)

The subject kind of says it all. Since applications are ".app" directories, and 
executing the binary in the MacOS subdir doesn't
seem to work, is there a way to launch a MacOS
application from a shell?


----------



## btoneill (Jan 9, 2003)

open /Applications/iPhoto.app 

Brian


----------



## strobe (Jan 10, 2003)

also:

osascript -e 'launch the application "System Preferences"'


----------



## gatorparrots (Jan 10, 2003)

*EXAMPLES*
       'open /Volumes/Macintosh HD/foo.txt' opens the document in the default
     application for its type (as determined by LaunchServices).

      'open /Volumes/Macintosh HD/Applications/' opens that directory in the
     Finder.

      'open -a /Applications/TextEdit.app /Volumes/Macintosh HD/foo.txt' opens
     the document in the application specified (in this case, TextEdit).

      'open -e /Volumes/Macintosh HD/foo.txt' opens the document in TextEdit.

      'open http://www.apple.com/' opens the URL in the right browser.

      'open file://localhost/Volumes/Macintosh HD/foo.txt' opens the document
     in the default application for its type (as determined by LaunchSer-
     vices).

      'open file://localhost/Volumes/Macintosh HD/Applications/' opens that
     directory in the Finder.


----------



## jgc94131 (Jan 10, 2003)

Thanks!  You've answered my question. The man page on open is cool too.


----------



## lavacano (Jan 11, 2003)

some apps have console support too so it will verbose right to the terminal.  but to do thad you have to cd /path/to/.app/Contents/MacOS  then ./nameofapp& 

ex:  to load quake 3:

cd /Applications/quake3/Quake3.app/Contents/MacOS

./Quake3&

likewise if there is a bunch of gibberish displayed after the execution of the last command, you can only launch the app by open -a /path/to/app


----------

