Open a new Chrome window in Incognito mode from terminal

I can open a url specifying 'chrome browser' from terminal

open -a 'Google chrome' https://en.wikipedia.org/wiki/Main_Page

How to open it in an incognito mode?


Solution 1:

Use something like:

open -a "Google Chrome" --args --incognito "https://en.wikipedia.org/wiki/Main_Page"

Google Chrome accepts --incognito as a command-line option. To pass that option to the application via open, specify it after the --args flag.

If Chrome isn't already open (since this was not specified whether the original questioner needed to launch it fresh or if it was already running), -n is also needed to start a fresh instance.

In general, man open is your friend.

Solution 2:

I don't have enough reputation to comment on the above answer, but wanted to add that if you don't have an incognito window open already, you need to add the -n flag to open a new incognito instance. So, using the above example would be:

open -na "Google Chrome" --args --incognito "https://en.wikipedia.org/wiki/Main_Page"

Solution 3:

Use open chrome --args --incognito "websitename.com" to open it in icognito mode