open [-e| -t] [-f] [-F] [-W] [-R]
[-n] [-g] [-h hdr]
[-b bundle_identifier]
[-a application] file … [--args arg1 … ]
Opens a file (or a directory or URL), just as if you had double-clicked the file's icon.
If no application name is specified, the default application as determined via LaunchServices is used to open the specified files.
If the file is in the form of a URL, the file will be opened as a URL.
You can specify one or more file names (or pathnames), which are interpreted relative to the shell or Terminal window's current working
directory. For example, the following command would open all Word files in the current working directory:
open *.doc
Opened applications inherit environment variables just as if you had launched the application directly through its full path. This
behavior was also present in Tiger.
-a application | |||||||||||||||||||||
--args |
open '/Volumes/DATA/food.jpg'
open home directory in the Finder: open ~
Open file in the application specified: open -a .bin/MacVimPreview.app food.txt
Open file using the bundle .
Open file in TextEdit.
Write output of the 'ls' command to a file in /tmp and
Open URL in the default browser.
Open file in the default application for its type (as determined by LaunchServices).
Open a directory in the Finder:
List headers whose names contain NSView and allows you to choose which ones to open:
Quickly open /System/Library/Frameworks/Foundation.framework/Headers/NSString.h
open -b com.apple.TextEdit '/Volumes/DATA/food.txt'"
open -e '/Volumes/DATA/foo.txt'"
opens the file in the default text editor (as determined by
LaunchServices). ls | open -f
open http://www.apple.com/
open 'file://localhost/Volumes/DATA/food.txt' open 'file://localhost/Volumes/DATA/Applications/'
open -h NSView
in Xcode: open -a Xcode -h NSString.h