Dan smith Dan smith - 1 month ago 14
Node.js Question

How to open the chrome browser to a chrome dev tool url

With the most recent version of node,


node --inspect ajavascriptfile.js

Outputs a url for you to visit in your chrome browser, great!

(Documentation for V8 inspector here)

But how can I open that url with my terminal?

I can open the browser for files or urls with:

open -a Google\ Chrome ./path/to/file.html


open -a Google\ Chrome http://google.com

But trying the same for the url:

open -a Google\ Chrome chrome-devtools://devtools/remote/se...

Gives me the error:

The file /Users/samhouston/proj/chrome-devtools:/devtools/remote/se... does not exist.

How can I get chrome to open its browser to this url through my terminal?

Thanks in advance for the help


open doesn't support the chrome-devtools protocol, so it just tries to open a local file path instead. Since it doesn't exist, it gives you the error you are getting.

I looked around for another solution and I found that you can use an osascript to tell the application itself to open the URL.

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome & osascript -e 'tell application "Google Chrome" to open location "chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node"'