Open HTML file with Google Chrome using command-line In default installation of macOS, Python and Bash are installed in /usr/bin and /bin directories respectively.

$ which python
/usr/bin/python

$ which bash
/bin/bash


So it's appropriate files can be opened using the command-line as:

python foo.py


Along similar lines, I want the ability to open an HTML file with Google Chrome using the command-line as:

$ chrome foo.html


But I get the following output:

bash: chrome: command not found


An alternate way to achieve the desired workflow is make Google Chrome as the default browser and execute the following command:

open foo.html


How do I achieve the former workflow?
There is no need to create or copy any file into /usr/bin directory. A simple solution would be create an alias as shown below:

alias chrome="open -a \"Google Chrome\".

Now you open the HTML file as you described by executing:

chrome foo.html

You may wish to export the alias to make the behaviour permanent placing the alias in .bash_profile in your home directory.