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

Reply
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.