open -a iTunes
Use quotes if the app name has spaces:
open -a "App Store"
Open the file with a specific software. You can also use this command to actively open certain file types using the default application. Just type the path, followed by -a and the application name. If you're unclear about entering file paths, see the Troubleshooting section below.
For example, you can open a .doc file with TextEdit:
open Downloads/Instructions.doc -a TextEdit
Add additional options. Type info open to see a complete list of additional options for the open command . (After viewing, click ControlCto return to the command line.) Here are some basic examples:
Use -e to specify the TextEdit program, or -t to specify the default text editor:
open Downloads/Instructions.doc -e
Add -g to keep the app running in the background so you can continue working in Terminal:
open -g -a iTunes
Add -F to open a "new" copy of the application. Your unsaved changes will be lost, but this can be useful if opening a document causes the previous application to freeze:
open -F -a TextEdit
Open multiple windows of the same application by adding -n. This is suitable for comparing different levels of access, or if the application only allows one window to be open. For example, enter this command multiple times to open multiple windows of the alarm program:
open -n -a "Wake Up Time" (Note: this is not a default OS X program.)
For applications that are correlated with their own copies, it can cause unexpected problems.
Run the application in Terminal. Instead of just opening an application as usual, Terminal also has control capabilities. This feature is suitable for handling error messages or control information that the computer displays on the Terminal window. Proceed as follows:
Locate the application in Finder.
Right-click the application and select "Show Package Contents".
Locate the executable file. Typically, the file will be in Contents → MacOS and have the same content as the application.
Drag the file and drop it onto the empty Terminal command line. Press Enter to run the program.
While using the program, you need to leave the Terminal window open. When you exit the application, Terminal will return to normal mode.
Find the application name. If Terminal reports the error "Unable to find application named.," determine the exact name of the application by browsing the alphabetical list of programs. female:
Click the apple icon in the upper left corner of the screen.
Hold down the key ⌥ Optionand click System Information in the drop-down menu.
In the left bar of the System Information window, click Software → Applications. It will take a few minutes for this list to appear.
Understanding absolute paths. If Terminal says "the file . does not exist," it means you entered the wrong path. The easiest way to avoid this mistake is to drag the file from the Finder folder and drop it into the Terminal command line (after typing "open," drop the file in and press Enter.) The absolute path of the file will be entered and adjusted. heading to the right place.
An absolute path always begins with the character / . This character shows the file path relative to the root directory (usually "Macintosh HD" – the default drive partition).
Understand relative paths. The beginning of a Terminal command is always the current directory you are in. By default, the root folder name will be after your username. A relative path will start with ./ or a regular character, meaning the file is located relative to the directory you are accessing. If you're still having trouble, follow these steps:
Enter pwd to check the current directory. The file you want to open must be within this directory and not in a higher branch.
Locate your current folder in Finder. Open a series of folders until you find the file you want to open.
Enter the name of the folder you want to open, separated by / and then ending with the file name. For example, open Documents/Writing/Novel/ch3.pdf. (If you put ./ before Documents, it will still produce the same result.)
Convert folders. You can return to the root directory with cd ~/, or move to a lower directory by adding 'cd' after the directory name — for example, cd Documents/Finances. Note, the file you are opening must be in the current directory, however, even if the location cannot be determined, we can still proceed to open the file with the application.
Find the right file. The file name must include the extension at the end. If the extension is hidden, you can use one of the following methods to identify it:
Select the file in Finder. Press ⌘ Command+ I. On the Info window, look for "file name & extension" to see the full name.
Or , go to the folder containing the file. Enter ls into the Terminal command line to list the files in the directory.
Another way is to drag and drop the file into the Terminal window.