You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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.

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.