Name

open

Synopsis

open file
open [-a application] file
open [-e] file

The open command can be used to open files and directories, and to launch applications from the Terminal application.

Options

-a application

Use application to open the file.

-b identifier

Specifes the application to open the file with, as identified with identifier. For example, to open a CSV-format file names.csv with Excel, use open -b com.microsoft.Excel names.csv.

-e file

Force the use of Mac OS X’s TextEdit application to open the specified file.

-f

Read input from standard input and open the text in TextEdit.

-t file

Open file with the default text editor, which may not be TextEdit.

Examples

To open a directory in the Finder, use open, followed by the name of the directory. For example, to open the current directory, type:

$ open .

To open your Public folder in the Finder:

$ open ~/Public

To open the /Applications folder in the Finder:

$ open /Applications

To open an application, you need only its name. For example, you can open Xcode (/Developer/Applications) with this command:

$ open -a Xcode

You aren’t required to enter the path for the application—only its name—even if it is a Classic application. The only time you are required to enter the path is if you have two different versions of an application with similar names on your system.

You can also supply a filename argument with the -a option, which launches the application and opens the specified file with that application. You can use this option to open a file ...

Get Mac OS X Tiger in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.