​​ ​

The Apple Support Community will permanently close on November 20, 2026. Starting today, the site will no longer accept new posts and is available in a read-only state.


You can continue to find trusted guidance and support on the official Apple Support site. 


We want to thank the community members who have contributed their time and expertise to help others with their Apple products.


Launch program from terminal

How do I launch a program from the "terminal" window?


MacBook Air 13", macOS 10.15

Posted on Nov 15, 2019 9:06 AM

Question marked as Top-ranking reply

Posted on Nov 15, 2019 9:30 AM

If it is a GUI application (e.g. .app)

open -a "application name" URL or document name
open -a Safari "https://www.apple.com"


otherwise, it would depend where in the filesystem, the non-GUI application resides, what your PATH environment variable has been set too, and what arguments the command takes from the command-line:

man -t zsh | open -f -a Preview
ruby -e 'puts ARGV.first.capitalize;' "CAT_AND_MOUSE_GAME"
~/Desktop/customprog.py ~/Desktop/input.txt
./located_right_here ./"white-space punctuated input".txt


The tilde (~) character is shorthand for your home directory (e.g. /Users/yourname, etc.). The leading dot means in the current folder location.

2 replies
Question marked as Top-ranking reply

Nov 15, 2019 9:30 AM in response to rodg495

If it is a GUI application (e.g. .app)

open -a "application name" URL or document name
open -a Safari "https://www.apple.com"


otherwise, it would depend where in the filesystem, the non-GUI application resides, what your PATH environment variable has been set too, and what arguments the command takes from the command-line:

man -t zsh | open -f -a Preview
ruby -e 'puts ARGV.first.capitalize;' "CAT_AND_MOUSE_GAME"
~/Desktop/customprog.py ~/Desktop/input.txt
./located_right_here ./"white-space punctuated input".txt


The tilde (~) character is shorthand for your home directory (e.g. /Users/yourname, etc.). The leading dot means in the current folder location.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Launch program from terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.