Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run the Safari browser (on Mac OS 10.4) from the command line, as follows:

/Applications/Safari.app/Contents/MacOS/Safari http://localhost/dev/myfile.html

However, Safari starts up and tries to access

file:///Users/charlesanderson/scripts/http://localhost/dev/myfile.html

/Users/charlesanderson/scripts happens to be my current directory.

Can someone explain why Safari does this? Firefox is much better behaved?

share|improve this question
up vote 10 down vote accepted

Starting Safari with arguments isn't supported or documented, AFAIK.

It's interpreting the first argument as a path (you'll notice that if you begin it with a /, it doesn't prepend the working directory).

If you just want Safari to navigate to a URL, use open:

open -a Safari <url>
share|improve this answer

How about

open -a Safari URL
share|improve this answer

Apparently open also handles URI protocols directly:

open http://google.com
# or
open 'http://google.com'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .