How to Open Apps Through Terminal on Mac: 12 Steps

Table of contents:

How to Open Apps Through Terminal on Mac: 12 Steps
How to Open Apps Through Terminal on Mac: 12 Steps

Video: How to Open Apps Through Terminal on Mac: 12 Steps

Video: How to Open Apps Through Terminal on Mac: 12 Steps
Video: How to Change Wallpaper MacBook 2024, December
Anonim

The Terminal application on OS X provides a complete UNIX interface. In a Terminal window, you can enter commands to open any application, or to open files with an application of your choice. Commands in Terminal can be customized to suit your needs. For example, you can open an application directly in a Terminal window.

Step

Method 1 of 2: Opening the App

Open Applications Using Terminal on Mac Step 1
Open Applications Using Terminal on Mac Step 1

Step 1. Find the Terminal icon in the Applications → Utilities → Terminal folder

You can also use Spotlight in the upper-right corner of the screen to search for Terminal.

Open Applications Using Terminal on Mac Step 2
Open Applications Using Terminal on Mac Step 2

Step 2. Open the app from anywhere

Generally, the "open" command requires that you enter the full address of the file from Active Directory. However, with the "-a" parameter (followed by the application name), you can open the application from any folder. For example:

  • To open iTunes:

    open -a iTunes

  • To open an application with a name containing spaces, put quotation marks in the application name, for example:

    open -a "App Store"

Open Applications Using Terminal on Mac Step 3
Open Applications Using Terminal on Mac Step 3

Step 3. Open the file with a specific application

You can also use Terminal to override the default application settings. Enter the file address, followed by the "-a" parameter and the name of the application. If you don't know how to enter the file address, see the "Troubleshooting" section of this article.

  • For example, to open a.doc file with TextEdit, use the following command:

    open Downloads/Instructions.doc -a TextEdit

Open Applications Using Terminal on Mac Step 4
Open Applications Using Terminal on Mac Step 4

Step 4. Include additional parameters

The "info open" command will display parameters that you can use with the "open" command. When you have finished reading the wizard, press ControlC to return to the command line interface. Here are some examples of using parameters:

  • Use the "-e" parameter to open text with TextEdit, or "-t" to open text with a text editor of your choice. For example:

    open Downloads/Instructions.doc -e

  • Use the "-g" parameter to open the application in the background and keep the focus on the Terminal window. For example:

    open -g -a iTunes

Open Applications Using Terminal on Mac Step 5
Open Applications Using Terminal on Mac Step 5

Step 5. Add the "-F" parameter to open a new copy of the application

Although your unsaved work will be lost, this parameter will help you open the application if it turns out that the file you opened is the cause of the application not responding. For example:

open -F -a TextEdit

Open Applications Using Terminal on Mac Step 6
Open Applications Using Terminal on Mac Step 6

Step 6. Open multiple copies of the application at once with the "-n" parameter

This option will be useful for comparing access levels, or if the application only allows one window. For example, repeat this command several times to open multiple copies of the alarm clock app:

  • open -n -a "Wake Up Time" (Note: this app is not an OS X default app.)
  • Apps that interact with duplicated apps may experience issues.
Open Applications Using Terminal on Mac Step 7
Open Applications Using Terminal on Mac Step 7

Step 7. Run the application in Terminal

Terminal lets you open applications within a Terminal window, instead of in a standalone window. This option is useful for troubleshooting application errors during development because all error messages and console output will appear in the Terminal window. Follow these steps to run the application in Terminal:

  • Find apps with Finder.
  • Right-click the application, then select Show Package Contents.
  • Find the program's main file. This file can generally be found in the Contents → MacOS folder, and has the same name as the program.
  • Drag the file into a Terminal window, then press Enter to open the program.
  • Keep the Terminal window open while you use the app. To restore the Terminal window, exit the application.

Method 2 of 2: Troubleshooting

Open Applications Using Terminal on Mac Step 8
Open Applications Using Terminal on Mac Step 8

Step 1. Find the app name

If Terminal displays the Unable to find application named… error message, find the application name by displaying a list of all applications. This list is arranged alphabetically.

  • Click the Apple symbol in the top-left corner of the screen.
  • Hold down Option and click System Information from the menu.
  • On the left side of the System Information window, click Software → Applications. Wait a few moments for the list of applications to finish loading.
Open Applications Using Terminal on Mac Step 9
Open Applications Using Terminal on Mac Step 9

Step 2. Understand the absolute file address

If Terminal displays the error message the file … does not exist, you may have entered the wrong file address. One way to avoid miswriting the file address is to drag the file you want to open directly into the Terminal window after typing the "open" command, but before pressing Enter. This way, Terminal will point to the file you're referring to.

Absolute file addresses always begin with a "/" symbol. This address indicates the location of the file from the starting directory (usually "Macintosh HD")

Open Applications Using Terminal on Mac Step 10
Open Applications Using Terminal on Mac Step 10

Step 3. Understand the relative file addresses

The beginning of the Terminal command line always displays the working directory. Generally, you will be in the home directory, which is the same name as your account name. Relative file addresses start with "./" (or don't start with any special characters at all). In contrast to absolute file addresses, relative file addresses indicate the file location of the current working directory. If you're having trouble figuring out your working directory, consider the following steps:

  • Use the pwd command to check the current working directory. Make sure the file you want to open is in the working directory, not above it.
  • Find the working directory in the Finder. Open the folder where you saved the file until you find the file.
  • Enter the name of the folder you have opened, separated by a "/" symbol. After that, end with the file name. For example, to open the file "ch3.pdf", use the command open Documents/Writing/Novel/ch3.pdf. In this case, you can start the folder name with a "./" symbol in front of Documents.
Open Applications Using Terminal on Mac Step 11
Open Applications Using Terminal on Mac Step 11

Step 4. Switch to another directory

To access the home directory, use the command cd ~/. Or, to move to a different directory, follow the "cd" command with the directory name (eg cd Documents/Finances). Keep in mind that the file you want to open must be in the working directory, but you can use any application to open the file, no matter where the application you want is installed is.

Open Applications Using Terminal on Mac Step 12
Open Applications Using Terminal on Mac Step 12

Step 5. Know the file name

Make sure your file name ends with the extension. If the extension in the filename is hidden, follow one of the methods below to show it again:

  • Select the file you want in the Finder, then press Command+I. In the Info window, find the File name & extension entry to view the full file name.
  • Go to the folder where you saved the file and enter the ls command. The contents of the directory will appear in the Terminal window.
  • Drag and drop the file you want to open into a Terminal window.

Tips

You can use the character "*" as a wildcard character that represents a set of characters, or "?" as a wildcard character that represents a single character. You can use these two characters when opening files, but you can't use them to open applications. For example, the open budget* command will open the first file in the working directory starting with "budget". On the other hand, the open budget?.pdf command can be used to open "budget1.pdf", but cannot be used to open "budget2015.pdf" because of the character "?" represents only a single character

Recommended: