Enable remote debugging on Chrome by default on mac?

旧时模样 提交于 2020-07-18 04:45:10

问题


I am working on getting the VS Code debugger to attach to Chrome as part of my regular workflow.

I keep Chrome running all the time, and the highly-regarded VS Code Live Server extension opens my project in a new tab, which I like. I would like to be able to attach the VS Code debugger to this instance, but it looks like I have to start Chrome from the command line with

sudo /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222

Several questions:

  1. Is there a way to modify Chrome's configuration file so that it always starts with that flag set?
  2. Is that a stupid thing to do?
  3. Do I really need the sudo in the line above? Some sources do not have it.
  4. Alternatively, is there a way to create a desktop/toolbar shortcut to chrome that will start it will remote debugging enabled?

Thanks!

PS I see the related SO question for Windows.


回答1:


There are various Mac answers that used to work that don't anymore. I found one that does and built a double-clickable icon. I posted it on GitHub.

Apparently it's pretty easy to do using Automator, also.




回答2:


There's a great tutorial on how to do this with Automator here: http://kynatro.com/blog/2018/01/11/chrome-debugging-in-vscode/



来源:https://stackoverflow.com/questions/56043142/enable-remote-debugging-on-chrome-by-default-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!