PDF download Download Article
Learn how to launch apps using your Mac’s command line
PDF download Download Article

Your Mac's Terminal app gives you a text-based Unix command line inside the macOS environment. You can use the Terminal to run applications or open files in the program of your choice. In this wikiHow tutorial, you'll learn easy ways to launch applications from the Mac Terminal app, plus how to troubleshoot common problems you might encounter when opening apps in Terminal.

Launching Apps in Terminal: Fast Facts

  • To open an app in any location, type the command open -a “appname”. Make sure to capitalize the name of the app correctly.
  • You can also specify the path to the app (for example, open /Applications/Music.
  • To open a file in a specific app, use the open command followed by the full path to the file, then -a “appname”.
Section 1 of 2:

Opening an Application

PDF download Download Article
  1. The Terminal app comes with macOS and allows you to interact with your Mac using a text-based command line interface. There are several different ways to open it:[1]
  2. The open command normally requires you to input the full file path from your current directory. However, adding -a followed by the name of an application instructs Terminal to open that Application, no matter where it is located. This command is case sensitive, so make sure you capitalize the name of the app correctly. When you’re finished entering the command, press Enter. For example:[2]
    • To open Music: open -a Music
    • Use quotation marks if the application has a space in its name: open -a "App Store"
    Advertisement
  3. If you know the exact name and location of an app, you can open it by entering open followed by the path to the app. You might need to look up the app’s path using the ls (“list”) command first. For example:
    • See a list of all the apps in your Applications folder by entering the command ls /Applications.
    • Locate the app you want in the list and copy down its exact name (e.g., “Firefox.app”).
    • Enter the command open /Applications/[app name]. In this example, enter open /Applications/Firefox.app to launch Firefox.
      • If the app has multiple words in its name separated by a space, put quotation marks around the app’s name. For example, open /Applications/“Microsoft Teams.app”
  4. You can also use this command to override the default application for a file type. Just type in open, then the file path followed by -a and the application name. If you're not sure how to enter file paths, see the Troubleshooting section below. Most of the time, you can easily copy the file path by clicking the file to select it, then pressing Option + Command + C.
    • For example, you can open a .docx file with TextEdit: open /Users/[username]/Downloads/Resume.docx -a TextEdit
  5. If an app needs root privileges to run, the safest way to do that is to use sudo in the Terminal. You might need to temporarily disable System Integrity Protection to get this to work. Make sure to turn SIP back on when you’re done to protect your Mac from security issues.
    • Log in to your Mac using an administrator account.
    • Open Terminal.
    • Enter the command sudo followed by the path to the app you want to open. The command should look something like this: sudo /Applications/YourAppName.app/Contents/MacOS/YourAppName.
      • Replace “YourAppName” with the actual name of the app. If the app’s name has multiple words with spaces in between, surround it in quotation marks.
      • If entering the path manually doesn’t work, right-click (or Ctrl-click) the app and select Show Package Contents. Open Contents > MacOS and find the app file, then drag it into the Terminal window after the sudo command.
    • Press Return.
    • Enter your administrator password if prompted, then press Return again. The app should launch with root privileges enabled. If it doesn’t work, disable SIP and try again.
  6. Advertisement
Section 2 of 2:

Troubleshooting

PDF download Download Article
  1. If Terminal displays the error message "Unable to find application named...," find the exact name of the application by browsing an alphabetical list:
  2. If Terminal displays "The file ... does not exist," you did not type the correct file path. An easy way to avoid mistakes is to drag and drop the file from Finder directly into your Terminal command line (after typing "open" and a space, but before hitting Return.) This will enter the absolute file path, which will always point to that file.[3]
    • An absolute file path always begins with the symbol /. It describes the file path in relation to the root directory (usually "Macintosh HD").
    • You can also copy the file path by clicking the file to highlight it, then pressing Option + Command + C.
    • If you’re trying to open an application or file in your Home directory (which is your default location in Terminal), you might not need to enter the full absolute file path. For example, you can typically open an app in your current directory by simply entering open /Applications/[appname]. This is called a “relative file path” because it is relative to your current location.
  3. If you’re opening a file within an app, the file name must include the extension at the end of its name. If the extension is hidden, use any of these methods to find it:
    • Select the file in Finder. Press Command + I. In the Info window, look for "Name & Extension" to see the whole name.
    • Or enter the command ls followed by the path to the location where the file is located. For example, ls /Users/[username]/Downloads will list all the files in your Downloads folder (replace “[username]” with your username). Find the name of your file in the list.
    • Or drag and drop the file into your Terminal window. This will show you the file’s path and full name.
  4. Advertisement

Community Q&A

Search
Add New Question
  • Question
    Why does Safari open automatically when I log into my laptop?
    Mariam Atbouli
    Mariam Atbouli
    Community Answer
    Try right-clicking Safari in your dock. Choose options > Open at Login. If there is a tick, uncheck it.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Video

Tips


Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

You Might Also Like

Run a Program from the Command Line on LinuxRun a Program from the Command Line on Linux
Run Files in LinuxRun Files in Linux
Run a Program on Command Prompt Run a Program at the Windows Command Prompt: 2 Ways
Get to the Command Line on a Mac Get to the Command Line on a Mac Desktop or MacBook
Open a Terminal Window in Mac3 Easy Ways to Open a Terminal Window on a Mac
Open Applications With Root Privileges on a Mac Run Apps with Root Permissions on a Mac
Applications Folder on MacWhere Is the Applications Folder on Mac? How to Access It & More
Run a BAT File on Windows3 Ways to Run a Batch (.BAT) file on Windows and More
Check Path in UnixCheck Path in Unix
CD to iCloud Drive on Mac CD to Your iCloud Drive on a Mac
Connect to a Server on a MacConnect to a Server on a Mac
Create a File in a Directory in LinuxCreate a File in a Directory in Linux
Run a Batch File from the Command Line on Windows Execute a Batch File from the Command Line (CMD)
Open EXE Files Run EXE files on Windows, Mac, and Linux
Advertisement

About This Article

Megaera Lorenz, PhD
Written by:
wikiHow Staff Writer
This article was co-authored by wikiHow staff writer, Megaera Lorenz, PhD. Megaera Lorenz is an Egyptologist and Writer with over 20 years of experience in public education. In 2017, she graduated with her PhD in Egyptology from The University of Chicago, where she served for several years as a content advisor and program facilitator for the Oriental Institute Museum’s Public Education office. She has also developed and taught Egyptology courses at The University of Chicago and Loyola University Chicago. This article has been viewed 1,061,659 times.
How helpful is this?
Co-authors: 13
Updated: March 2, 2026
Views: 1,061,659
Categories: Mac
Article SummaryX

1. Use "open -a appname" to launch an app.
2. Use "open path/to/file -a appname" to open a file with an app.
3. Add "-g" to keep the file in the background.
4. Add "-F" to open a fresh copy of the app.
5. Use "-n" to open multiple instances.

Did this summary help you?

Thanks to all authors for creating a page that has been read 1,061,659 times.

Is this article up to date?

Advertisement