MacOS – Why can’t I easily open web browsers from the terminal application

macosterminal

In order to run Chrome from the Terminal application, I have to do

open -a "Google Chrome" index.html

rather than just something like "chrome index.html".

The same also seems to be true for Firefox.

It's not because I can't open any GUI applications from the command line. For example, I can do mate . to open TextMate.

What's the rationale for web browsers not having a command like "chrome index.html"?

Best Answer

To open a application from the terminal it has to be in one of the paths of your $PATH environnement variable.

By default /Application/ where Chrome is located is not in your path. Therefore you can't launch an application without giving the full path to your app.

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome http://google.com

Will work.