22

I can run Google Chrome from the command line using $ google-chrome, but what flag can I pass to open it with developer console already open, preferably open to the console tab?

I checked the man page for google-chrome but it states that

Google Chrome has hundreds of undocumented command-line flags that are added and removed at the whim of the developers.

I'm hoping one of those undocumented flags does what I want.

Maros
  • 1,825
  • 4
  • 25
  • 56

4 Answers4

16

The flag you're looking for is --auto-open-devtools-for-tabs. Please note, that you should quit Chrome before this setting will take effect.

This has worked at least since Chrome 55.0.2883.87 m (the latest version as of initial post)

Dethariel
  • 3,394
  • 4
  • 33
  • 47
  • 2
    uh no it doesn't work, it starts chrome normally without the dev tools open. – shinzou May 11 '17 at 07:56
  • @kuhaku this worked for everybody I spoke with so far. Are you sure you're spinning up chrome correctly? – Dethariel May 15 '17 at 22:02
  • It does work. You just need to flag '--args' and then '--auto-open-devtools-for-tabs'. Also make sure you quit Chrome before running the command. – toad Aug 08 '17 at 19:15
  • 1
    This argument will open devtools on every new tab, not just the requested page, and you need to exit Chrome before running the command. – Nacho Coloma Sep 17 '17 at 08:47
  • Didn't work for me, but I didn't close Chrome beforehand. – Brian Hannay Jan 06 '18 at 04:41
9

A Google employee maintains this list of automatically updated Chromium flags. There doesn't seem to be a flag for opening Chrome with developer console open.

Maros
  • 1,825
  • 4
  • 25
  • 56
  • 1
    You should change your accepted answer to [@Dethariel's one](http://stackoverflow.com/a/41452619/4194289) it works on newer versions of chrome. – statox Jan 26 '17 at 15:40
1

What exactly are you trying to achieve by that? If you are trying to run some kind of automated tests, you should try out PhantomJS.

meetar
  • 7,443
  • 8
  • 42
  • 73
Varunkumar Nagarajan
  • 1,807
  • 1
  • 24
  • 43
1

Seems there is no such option. I added a feature request in Chrome product forum https://productforums.google.com/forum/#!category-topic/chrome/give-feature-feedback-and-suggestions/mac/Stable/3HYIAl8_ndc

mkraemerx
  • 1,713
  • 2
  • 17
  • 21