The MacOS X open(1) Command23 Mar 2011
MacOS X provides a commnad line tool to open applications and files. MacOS X applications are actually collections of files residing within one directory with a name ending in .app. I usually use
open at the command line to start most applications, leaving the Dock clear of applications not running:
is enough to start Safari and if the browser is already running, it will open a new window.
open command also works on individual files and will open the file in its associated application. For instance, running open on a PDF will open the file in Preview. And running
open on a normal directory (as opposed to an application package) will open the directory in Finder.
open command provides a number of useful options. The option t treats the file, regardless of type, as a text file and opens it in the default text editor. A related option, e simplifies the process and opens the file in TextEdit, the native text editor provided with MacOS X. Also related is f, which reads from the standard input and passes the input to the default text editor.
It is also possible to override the default application with other types of files using the option a. But it is important to remember the full path to the application must be given:
This form is quite cumbersome, but it may be appropriate in some circumstances. One last option worth mentioning is R which find the references file in Finder, instead of opening the file itself. Of course,
open supports other options as well and reveiwing the man page is advised.
open supports URLs:
will open my website directly in the default browser.