How can I open a URL in Google Chrome from the terminal in OS X?












76















How can I open a URL in Google Chrome from the terminal in OS X?



This is what I'm trying:



/usr/bin/open -a "/Applications/Google Chrome.app" --args 'http://google.com/'


It focuses Chrome but does not open the URL.










share|improve this question













migrated from stackoverflow.com Oct 25 '11 at 12:59


This question came from our site for professional and enthusiast programmers.
















  • why do you reference the open programm by it's path? It's aliased by default!

    – nimrod
    May 11 '13 at 4:31
















76















How can I open a URL in Google Chrome from the terminal in OS X?



This is what I'm trying:



/usr/bin/open -a "/Applications/Google Chrome.app" --args 'http://google.com/'


It focuses Chrome but does not open the URL.










share|improve this question













migrated from stackoverflow.com Oct 25 '11 at 12:59


This question came from our site for professional and enthusiast programmers.
















  • why do you reference the open programm by it's path? It's aliased by default!

    – nimrod
    May 11 '13 at 4:31














76












76








76


28






How can I open a URL in Google Chrome from the terminal in OS X?



This is what I'm trying:



/usr/bin/open -a "/Applications/Google Chrome.app" --args 'http://google.com/'


It focuses Chrome but does not open the URL.










share|improve this question














How can I open a URL in Google Chrome from the terminal in OS X?



This is what I'm trying:



/usr/bin/open -a "/Applications/Google Chrome.app" --args 'http://google.com/'


It focuses Chrome but does not open the URL.







macos google-chrome terminal






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 18 '11 at 4:42









cwdcwd

5,9683694143




5,9683694143




migrated from stackoverflow.com Oct 25 '11 at 12:59


This question came from our site for professional and enthusiast programmers.






migrated from stackoverflow.com Oct 25 '11 at 12:59


This question came from our site for professional and enthusiast programmers.















  • why do you reference the open programm by it's path? It's aliased by default!

    – nimrod
    May 11 '13 at 4:31



















  • why do you reference the open programm by it's path? It's aliased by default!

    – nimrod
    May 11 '13 at 4:31

















why do you reference the open programm by it's path? It's aliased by default!

– nimrod
May 11 '13 at 4:31





why do you reference the open programm by it's path? It's aliased by default!

– nimrod
May 11 '13 at 4:31










9 Answers
9






active

oldest

votes


















46














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)






share|improve this answer
























  • weird. seems like i used to have to use them. thanks.

    – cwd
    Oct 18 '11 at 4:48











  • thanks for explaining the --args behaviour

    – ptim
    Apr 12 '15 at 7:19



















57














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






share|improve this answer

































    41














    If you set Google Chrome as your default browser



    open http://google.com/


    will just do the trick.



    OS X version: 10.8.4






    share|improve this answer


























    • OS X 10.10 Yosemite as well.

      – leymannx
      Jun 17 '15 at 9:28











    • This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

      – tgf
      Mar 17 '16 at 2:32






    • 1





      good answer, now how do I do this in a new Chrome window?

      – chharvey
      May 13 '16 at 2:31



















    9














    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






    share|improve this answer


























    • function chrome(){ open -a "Google Chrome" "$*" }

      – Joel AZEMAR
      Jul 1 '15 at 7:40



















    6














    I've an alias for google



    function google() { open /Applications/Google Chrome.app/ "http://www.google.com/search?q= $1"; }





    share|improve this answer
























    • that's a great idea :)

      – nimrod
      May 11 '13 at 4:30











    • for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

      – nbari
      Jun 17 '15 at 10:02



















    4














    Get rid of the --args. open already knows how to handle URLs.






    share|improve this answer































      2














      this is my method.





      1. Update ~/.bash_profile and add the chrome function below:



        function chrome(){ 
        local site=""
        if [[ -f "$(pwd)/$1" ]]; then
        site="$(pwd)/$1"
        elif [[ "$1" =~ "^http" ]]; then
        site="$1"
        else
        site="http://$1"
        fi
        /usr/bin/open -a "/Applications/Google Chrome.app" "$site";
        }


      2. Load ~/.bash_profile:
        source ~/.bash_profile


      3. Lunch chrome and open a site:
        chrome www.google.com


      4. Open a local site:
        chrome LOCAL_SITE_PATH







      share|improve this answer

































        0














        In macos Sierra 10.12.6 .If chrome is your default browser. You can do this by

        open index.html






        share|improve this answer































          0














          There are several helpful answers here but none that contain the complete info for opening a URL in Chrome in both cases whether it is or is not the default browser.





          1. Open a URL in the default browser (could be Chrome):



            open http://www.example.com



          2. Open a URL in Chrome always (using the app name):



            open -a "Google Chrome" http://www.example.com



          3. Open a URL in Chrome always (using the app path alternative syntax):



            open -a /Applications/Google Chrome.app/ http://example.com



          4. Open a URL in Chrome always (using the bundle identifier alternative syntax):



            open -b com.google.chrome http://www.example.com



          5. Open a URL in Chrome in an incognito window always:



            From man open, it would seem that you should be able to do it like this (but alas it does not seem to get the incognito option to Chrome):



            open -a "Google Chrome" http://example.com/ --args --incognito


            However, you can do it by passing the Chrome command line switches directly to the Chrome binary:



            /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito http://example.com







          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f350309%2fhow-can-i-open-a-url-in-google-chrome-from-the-terminal-in-os-x%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            46














            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)






            share|improve this answer
























            • weird. seems like i used to have to use them. thanks.

              – cwd
              Oct 18 '11 at 4:48











            • thanks for explaining the --args behaviour

              – ptim
              Apr 12 '15 at 7:19
















            46














            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)






            share|improve this answer
























            • weird. seems like i used to have to use them. thanks.

              – cwd
              Oct 18 '11 at 4:48











            • thanks for explaining the --args behaviour

              – ptim
              Apr 12 '15 at 7:19














            46












            46








            46







            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)






            share|improve this answer













            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)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 18 '11 at 4:44









            cobbalcobbal

            1,3191113




            1,3191113













            • weird. seems like i used to have to use them. thanks.

              – cwd
              Oct 18 '11 at 4:48











            • thanks for explaining the --args behaviour

              – ptim
              Apr 12 '15 at 7:19



















            • weird. seems like i used to have to use them. thanks.

              – cwd
              Oct 18 '11 at 4:48











            • thanks for explaining the --args behaviour

              – ptim
              Apr 12 '15 at 7:19

















            weird. seems like i used to have to use them. thanks.

            – cwd
            Oct 18 '11 at 4:48





            weird. seems like i used to have to use them. thanks.

            – cwd
            Oct 18 '11 at 4:48













            thanks for explaining the --args behaviour

            – ptim
            Apr 12 '15 at 7:19





            thanks for explaining the --args behaviour

            – ptim
            Apr 12 '15 at 7:19













            57














            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






            share|improve this answer






























              57














              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






              share|improve this answer




























                57












                57








                57







                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






                share|improve this answer















                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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 5 '17 at 18:16

























                answered Dec 19 '12 at 18:34









                ArsalArsal

                67055




                67055























                    41














                    If you set Google Chrome as your default browser



                    open http://google.com/


                    will just do the trick.



                    OS X version: 10.8.4






                    share|improve this answer


























                    • OS X 10.10 Yosemite as well.

                      – leymannx
                      Jun 17 '15 at 9:28











                    • This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                      – tgf
                      Mar 17 '16 at 2:32






                    • 1





                      good answer, now how do I do this in a new Chrome window?

                      – chharvey
                      May 13 '16 at 2:31
















                    41














                    If you set Google Chrome as your default browser



                    open http://google.com/


                    will just do the trick.



                    OS X version: 10.8.4






                    share|improve this answer


























                    • OS X 10.10 Yosemite as well.

                      – leymannx
                      Jun 17 '15 at 9:28











                    • This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                      – tgf
                      Mar 17 '16 at 2:32






                    • 1





                      good answer, now how do I do this in a new Chrome window?

                      – chharvey
                      May 13 '16 at 2:31














                    41












                    41








                    41







                    If you set Google Chrome as your default browser



                    open http://google.com/


                    will just do the trick.



                    OS X version: 10.8.4






                    share|improve this answer















                    If you set Google Chrome as your default browser



                    open http://google.com/


                    will just do the trick.



                    OS X version: 10.8.4







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 30 '15 at 8:56









                    Daz Lewis

                    1035




                    1035










                    answered Sep 4 '13 at 6:04









                    alikewmkalikewmk

                    51943




                    51943













                    • OS X 10.10 Yosemite as well.

                      – leymannx
                      Jun 17 '15 at 9:28











                    • This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                      – tgf
                      Mar 17 '16 at 2:32






                    • 1





                      good answer, now how do I do this in a new Chrome window?

                      – chharvey
                      May 13 '16 at 2:31



















                    • OS X 10.10 Yosemite as well.

                      – leymannx
                      Jun 17 '15 at 9:28











                    • This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                      – tgf
                      Mar 17 '16 at 2:32






                    • 1





                      good answer, now how do I do this in a new Chrome window?

                      – chharvey
                      May 13 '16 at 2:31

















                    OS X 10.10 Yosemite as well.

                    – leymannx
                    Jun 17 '15 at 9:28





                    OS X 10.10 Yosemite as well.

                    – leymannx
                    Jun 17 '15 at 9:28













                    This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                    – tgf
                    Mar 17 '16 at 2:32





                    This only works if google chrome is your default browser. If you're using safari, firefox or another option but want to open the URL with chrome you'll need one of the other options.

                    – tgf
                    Mar 17 '16 at 2:32




                    1




                    1





                    good answer, now how do I do this in a new Chrome window?

                    – chharvey
                    May 13 '16 at 2:31





                    good answer, now how do I do this in a new Chrome window?

                    – chharvey
                    May 13 '16 at 2:31











                    9














                    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






                    share|improve this answer


























                    • function chrome(){ open -a "Google Chrome" "$*" }

                      – Joel AZEMAR
                      Jul 1 '15 at 7:40
















                    9














                    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






                    share|improve this answer


























                    • function chrome(){ open -a "Google Chrome" "$*" }

                      – Joel AZEMAR
                      Jul 1 '15 at 7:40














                    9












                    9








                    9







                    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






                    share|improve this answer















                    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







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 13 '17 at 12:45









                    Community

                    1




                    1










                    answered Jul 31 '14 at 12:11









                    Brad ParksBrad Parks

                    1,25011221




                    1,25011221













                    • function chrome(){ open -a "Google Chrome" "$*" }

                      – Joel AZEMAR
                      Jul 1 '15 at 7:40



















                    • function chrome(){ open -a "Google Chrome" "$*" }

                      – Joel AZEMAR
                      Jul 1 '15 at 7:40

















                    function chrome(){ open -a "Google Chrome" "$*" }

                    – Joel AZEMAR
                    Jul 1 '15 at 7:40





                    function chrome(){ open -a "Google Chrome" "$*" }

                    – Joel AZEMAR
                    Jul 1 '15 at 7:40











                    6














                    I've an alias for google



                    function google() { open /Applications/Google Chrome.app/ "http://www.google.com/search?q= $1"; }





                    share|improve this answer
























                    • that's a great idea :)

                      – nimrod
                      May 11 '13 at 4:30











                    • for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                      – nbari
                      Jun 17 '15 at 10:02
















                    6














                    I've an alias for google



                    function google() { open /Applications/Google Chrome.app/ "http://www.google.com/search?q= $1"; }





                    share|improve this answer
























                    • that's a great idea :)

                      – nimrod
                      May 11 '13 at 4:30











                    • for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                      – nbari
                      Jun 17 '15 at 10:02














                    6












                    6








                    6







                    I've an alias for google



                    function google() { open /Applications/Google Chrome.app/ "http://www.google.com/search?q= $1"; }





                    share|improve this answer













                    I've an alias for google



                    function google() { open /Applications/Google Chrome.app/ "http://www.google.com/search?q= $1"; }






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 8 '13 at 19:29









                    MohsenMohsen

                    17816




                    17816













                    • that's a great idea :)

                      – nimrod
                      May 11 '13 at 4:30











                    • for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                      – nbari
                      Jun 17 '15 at 10:02



















                    • that's a great idea :)

                      – nimrod
                      May 11 '13 at 4:30











                    • for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                      – nbari
                      Jun 17 '15 at 10:02

















                    that's a great idea :)

                    – nimrod
                    May 11 '13 at 4:30





                    that's a great idea :)

                    – nimrod
                    May 11 '13 at 4:30













                    for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                    – nbari
                    Jun 17 '15 at 10:02





                    for zsh: chrome() { open -a "Google Chrome" "http://www.google.com/search?q=$1"; }

                    – nbari
                    Jun 17 '15 at 10:02











                    4














                    Get rid of the --args. open already knows how to handle URLs.






                    share|improve this answer




























                      4














                      Get rid of the --args. open already knows how to handle URLs.






                      share|improve this answer


























                        4












                        4








                        4







                        Get rid of the --args. open already knows how to handle URLs.






                        share|improve this answer













                        Get rid of the --args. open already knows how to handle URLs.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Oct 18 '11 at 4:45









                        user7541user7541

                        21113




                        21113























                            2














                            this is my method.





                            1. Update ~/.bash_profile and add the chrome function below:



                              function chrome(){ 
                              local site=""
                              if [[ -f "$(pwd)/$1" ]]; then
                              site="$(pwd)/$1"
                              elif [[ "$1" =~ "^http" ]]; then
                              site="$1"
                              else
                              site="http://$1"
                              fi
                              /usr/bin/open -a "/Applications/Google Chrome.app" "$site";
                              }


                            2. Load ~/.bash_profile:
                              source ~/.bash_profile


                            3. Lunch chrome and open a site:
                              chrome www.google.com


                            4. Open a local site:
                              chrome LOCAL_SITE_PATH







                            share|improve this answer






























                              2














                              this is my method.





                              1. Update ~/.bash_profile and add the chrome function below:



                                function chrome(){ 
                                local site=""
                                if [[ -f "$(pwd)/$1" ]]; then
                                site="$(pwd)/$1"
                                elif [[ "$1" =~ "^http" ]]; then
                                site="$1"
                                else
                                site="http://$1"
                                fi
                                /usr/bin/open -a "/Applications/Google Chrome.app" "$site";
                                }


                              2. Load ~/.bash_profile:
                                source ~/.bash_profile


                              3. Lunch chrome and open a site:
                                chrome www.google.com


                              4. Open a local site:
                                chrome LOCAL_SITE_PATH







                              share|improve this answer




























                                2












                                2








                                2







                                this is my method.





                                1. Update ~/.bash_profile and add the chrome function below:



                                  function chrome(){ 
                                  local site=""
                                  if [[ -f "$(pwd)/$1" ]]; then
                                  site="$(pwd)/$1"
                                  elif [[ "$1" =~ "^http" ]]; then
                                  site="$1"
                                  else
                                  site="http://$1"
                                  fi
                                  /usr/bin/open -a "/Applications/Google Chrome.app" "$site";
                                  }


                                2. Load ~/.bash_profile:
                                  source ~/.bash_profile


                                3. Lunch chrome and open a site:
                                  chrome www.google.com


                                4. Open a local site:
                                  chrome LOCAL_SITE_PATH







                                share|improve this answer















                                this is my method.





                                1. Update ~/.bash_profile and add the chrome function below:



                                  function chrome(){ 
                                  local site=""
                                  if [[ -f "$(pwd)/$1" ]]; then
                                  site="$(pwd)/$1"
                                  elif [[ "$1" =~ "^http" ]]; then
                                  site="$1"
                                  else
                                  site="http://$1"
                                  fi
                                  /usr/bin/open -a "/Applications/Google Chrome.app" "$site";
                                  }


                                2. Load ~/.bash_profile:
                                  source ~/.bash_profile


                                3. Lunch chrome and open a site:
                                  chrome www.google.com


                                4. Open a local site:
                                  chrome LOCAL_SITE_PATH








                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Dec 4 '16 at 17:49

























                                answered Dec 4 '16 at 14:41







                                user671133






























                                    0














                                    In macos Sierra 10.12.6 .If chrome is your default browser. You can do this by

                                    open index.html






                                    share|improve this answer




























                                      0














                                      In macos Sierra 10.12.6 .If chrome is your default browser. You can do this by

                                      open index.html






                                      share|improve this answer


























                                        0












                                        0








                                        0







                                        In macos Sierra 10.12.6 .If chrome is your default browser. You can do this by

                                        open index.html






                                        share|improve this answer













                                        In macos Sierra 10.12.6 .If chrome is your default browser. You can do this by

                                        open index.html







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jul 22 '17 at 6:32









                                        daumiedaumie

                                        1012




                                        1012























                                            0














                                            There are several helpful answers here but none that contain the complete info for opening a URL in Chrome in both cases whether it is or is not the default browser.





                                            1. Open a URL in the default browser (could be Chrome):



                                              open http://www.example.com



                                            2. Open a URL in Chrome always (using the app name):



                                              open -a "Google Chrome" http://www.example.com



                                            3. Open a URL in Chrome always (using the app path alternative syntax):



                                              open -a /Applications/Google Chrome.app/ http://example.com



                                            4. Open a URL in Chrome always (using the bundle identifier alternative syntax):



                                              open -b com.google.chrome http://www.example.com



                                            5. Open a URL in Chrome in an incognito window always:



                                              From man open, it would seem that you should be able to do it like this (but alas it does not seem to get the incognito option to Chrome):



                                              open -a "Google Chrome" http://example.com/ --args --incognito


                                              However, you can do it by passing the Chrome command line switches directly to the Chrome binary:



                                              /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito http://example.com







                                            share|improve this answer






























                                              0














                                              There are several helpful answers here but none that contain the complete info for opening a URL in Chrome in both cases whether it is or is not the default browser.





                                              1. Open a URL in the default browser (could be Chrome):



                                                open http://www.example.com



                                              2. Open a URL in Chrome always (using the app name):



                                                open -a "Google Chrome" http://www.example.com



                                              3. Open a URL in Chrome always (using the app path alternative syntax):



                                                open -a /Applications/Google Chrome.app/ http://example.com



                                              4. Open a URL in Chrome always (using the bundle identifier alternative syntax):



                                                open -b com.google.chrome http://www.example.com



                                              5. Open a URL in Chrome in an incognito window always:



                                                From man open, it would seem that you should be able to do it like this (but alas it does not seem to get the incognito option to Chrome):



                                                open -a "Google Chrome" http://example.com/ --args --incognito


                                                However, you can do it by passing the Chrome command line switches directly to the Chrome binary:



                                                /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito http://example.com







                                              share|improve this answer




























                                                0












                                                0








                                                0







                                                There are several helpful answers here but none that contain the complete info for opening a URL in Chrome in both cases whether it is or is not the default browser.





                                                1. Open a URL in the default browser (could be Chrome):



                                                  open http://www.example.com



                                                2. Open a URL in Chrome always (using the app name):



                                                  open -a "Google Chrome" http://www.example.com



                                                3. Open a URL in Chrome always (using the app path alternative syntax):



                                                  open -a /Applications/Google Chrome.app/ http://example.com



                                                4. Open a URL in Chrome always (using the bundle identifier alternative syntax):



                                                  open -b com.google.chrome http://www.example.com



                                                5. Open a URL in Chrome in an incognito window always:



                                                  From man open, it would seem that you should be able to do it like this (but alas it does not seem to get the incognito option to Chrome):



                                                  open -a "Google Chrome" http://example.com/ --args --incognito


                                                  However, you can do it by passing the Chrome command line switches directly to the Chrome binary:



                                                  /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito http://example.com







                                                share|improve this answer















                                                There are several helpful answers here but none that contain the complete info for opening a URL in Chrome in both cases whether it is or is not the default browser.





                                                1. Open a URL in the default browser (could be Chrome):



                                                  open http://www.example.com



                                                2. Open a URL in Chrome always (using the app name):



                                                  open -a "Google Chrome" http://www.example.com



                                                3. Open a URL in Chrome always (using the app path alternative syntax):



                                                  open -a /Applications/Google Chrome.app/ http://example.com



                                                4. Open a URL in Chrome always (using the bundle identifier alternative syntax):



                                                  open -b com.google.chrome http://www.example.com



                                                5. Open a URL in Chrome in an incognito window always:



                                                  From man open, it would seem that you should be able to do it like this (but alas it does not seem to get the incognito option to Chrome):



                                                  open -a "Google Chrome" http://example.com/ --args --incognito


                                                  However, you can do it by passing the Chrome command line switches directly to the Chrome binary:



                                                  /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito http://example.com








                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Dec 13 '18 at 18:21

























                                                answered Dec 13 '18 at 17:43









                                                Taylor EdmistonTaylor Edmiston

                                                1358




                                                1358






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Super User!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f350309%2fhow-can-i-open-a-url-in-google-chrome-from-the-terminal-in-os-x%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Список кардиналов, возведённых папой римским Каликстом III

                                                    Deduzione

                                                    Mysql.sock missing - “Can't connect to local MySQL server through socket”