O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required