Open a URL in the Default Browser from the Command Line
Using the command line open tool, you can immediately launch any URL from the Terminal into the default web browser. The syntax is remarkably easy:
You can try this with any URL, even complex URL strings, although long query strings are best when placed into quotations. You can also specify port numbers:
Be sure to include http:// or https:// or it will look for a local file instead, but also suggest that you made an error: “Perhaps you meant ‘http://yahoo.com’?”
The open utility comes from Mac OS X’s ancestral NextStep roots and offers the ability to launch files and GUI apps from the command line. We’ve used it recently to a launch multiple instances of a single app, and to open the present working directory in Finder.