Open an .html file with default browser using Bash on Mac

DorBB picture DorBB · Apr 4, 2012 · Viewed 90.2k times · Source

So, this is what I need :

Let's say I have an index.html file.

How do I tell the terminal to open it using the default browser?

(Using AppleScript, BASH,...?)

Answer

kevlarkevin picture kevlarkevin · Apr 4, 2012

from the directory containing index.html, try...

open ./index.html

the open command opens a file (or directory, or URL). open is included with MacOSx. specifics and options can be found using

man open

note: default application is determined via LaunchServices.