How can I open a URL in Google Chrome from the terminal in OS X?
If you remove the --args
it seems to work fine, since --args
can only affect things on first launch (it changes what main gets called with)
Actually for me, the command is not working with the "--args" being present so the command working for me is
/usr/bin/open -a "/Applications/Google Chrome.app" 'http://google.com/'
OS X version: 10.6.8
If you set Google Chrome as your default browser
open http://google.com/
will just do the trick.
OS X version: 10.8.4
You can use
open -a "Google Chrome" index.html
or, to put it in a shell script (e.g. ~/bin/chrome)
-
edit the file ~/bin/chrome, and put the following in it
open -a "Google Chrome" "$*"
-
make the file executable by running the following in a terminal
chmod 700 ~/bin/chrome
-
then run the following to open a file in chrome from the terminal
chrome /path/to/some/file
Pulled from here
I've an alias for google
function google() { open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q= $1"; }