You can do many things with the Terminal application on your Mac. Launching an application may not be something that a lot of people think of, but it is something that you can easily do.
Whatever your reason, you can do this with the open command and the -a parameter, as shown below.
open -a <Application Name>
My name is Eric, and as a software engineer, I find all kinds of new ways to do things. I can do many different things with a command line application such as Mac Terminal. Launching an application from Terminal can be helpful, and I can show you how to do this.
Keep reading if you would like to see more details on how to launch an application on your Mac from Terminal. We will also examine some of the issues you may run into when trying to do this and discuss why you might want to launch applications using this method.
- Launch an Application from Terminal
- Problems Launching Some Applications
- Why Launch Applications from Terminal
Launch an Application from Terminal
I have touched on using the open command to launch an application above. Here I will go into a little more detail and provide some specific steps to perform this action. The open command isn’t specifically meant to launch applications, but it is intended to be used to open files.
When we specify the -a parameter, it tells the command to use an application specified after the -a parameter to open a file. If we do not provide a file for it to open, it just launches the application without any file. In a way, we are tricking the command into launching the application.
Below are the specific steps you should use to launch an application using the open command.
Step 1: Start the Terminal application.
Use your preferred method to start the Terminal application.
Step 2: Run the open command with your application name.
You can open any application using the open -a command. For my example below, I will launch the Finder application using this command.
open -a Finder
Step 3: Use your application.
Once the application has launched, you can begin using it just as you usually would.
Problems Launching Some Applications
As you use the above method to launch various applications, you may find that it only works for some. You will see an error message stating that the application cannot be found, as shown below.
The main reason for this is often that we are not using the full or complete name of the application. For example, if I want to start Chrome, I might use the following command.
open -a Chrome
This will not work because the application’s full name is Google Chrome. Since there is a space in the name, I will also need to put the name in quotation marks. So the command will look like this.
open -a “Google Chrome”
Most of the general applications that come with your macOS, such as Mail, Finder, Calculator, Safari, and more, have the same name you usually call them, so there are no worries with those. Other applications you have installed may have a different or longer name.
One way to find the name is to search for the application in Finder, or if you have an icon on your desktop to start the application, you can right-click on it and see the details, which will show you the full name of the application and that is what you should use with the open -a command.
Why Launch Applications from Terminal
If you have come to this page looking for a way to launch applications from Terminal, then you probably already have a good reason for doing so. If you don’t and are wondering why someone might want to do this, there are a few reasons someone might want to use the open command.
As a software engineer, I might want to open an application from within a shell script that I run in Mac Terminal. It could be that I am already in Mac Terminal, and it is just a convenient way to start up an application without using Finder or another desktop method.
It can also be that it is just an exercise to learn different ways of using Mac Terminal. Whatever the case, this is a terrific way to start an application, whether for necessity, convenience, or fun.
Launching an application from Mac Terminal can bring up several questions. Below are a few of the common ones that I often see.
Will an app launched from Terminal run differently than one started from my desktop?
No, when you launch an application from Terminal, it starts up just like when you start using the normal method from your desktop. The application will then run just as it would at any other time.
Does the open command have other parameters?
Yes, the open command does have many parameters and options. I won’t cover them here, but you can always use the man command to list them.
Can I use the open command to open a file?
Yes, you can. I mentioned briefly above that the open command is often used to specify an application to open a specific file type. For example, if I want to open a .pdf file from Terminal, I would use the command as shown below.
open -a “Adobe Acrobat Reader DC” myfile.pdf
Above, I have covered how to launch an application from Mac Terminal. You can use the open -a command, but you need to ensure that you use the full proper name of the application. I hope the above information has answered your questions about launching an application from Terminal.
Let me know if you have any questions or comments. I would love to hear from you.