Apple - Open HTML file with Google Chrome using command-line

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.


/usr/bin is a system directory owned by root user and it isn't possible to create any files in it due to Apple's System Integrity Protection introduced in Mac OS X El Capitan.

The command you are looking for is:

open -a "Google Chrome" foo.html

Description of command:

open -a "ApplicationToUse" file-to-open.extension

More details on the open command via man open on the command line.

In general, the above command-line can be used to launch any GUI app to open associated file.

open command is built into macOS. For more open command tips and tricks, refer this article, Shell tricks: the OS X open command.