1.這里需要設置一下環境變量
環境變量地址一般是在/Applications/Google Chrome.app/Contents/MacOS路徑下,如下圖所示:
2.經該路徑添加至環境變量:vi ~/.bash_profile
export PATH=/Applications/Google\ Chrome.app/Contents/MacOS:$PATH
不要忘了重啟后生效:source ~/.bash_profile
3.說一下在這里遇到的一個坑,添加環境變量的時候一開始不知道添加哪個,導致添加錯了,vi ~/.bash_profile和source ~/.bash_profile都提示找不到命令,這個時候解決方案,參考文章:
https://www.jianshu.com/p/be667b81ddba
4.生效后重啟終端,使用命令:Google\ Chrome,驗證如果打開了chrome瀏覽器,證明環境變量添加成功
5.使用以下命令就可以開啟debug模式了
Google\ Chrome -remote-debugging-port=9222