How to enable remote debugging in Chrome browser, supporting Windows and MacOS, Linux

Here are the methods to enable remote debugging for Chrome browser on various operating systems:

Windows Operating System:

  1. Ensure that you have installed Chrome browser and it is up to date.
  2. Open a command prompt window (press Win + R, enter "cmd", and then press Enter).
  3. C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
  4. In the Command Prompt window, enter the following command and press Enter:

    If your Chrome installation directory is different, please modify the command accordingly.

  5. Chrome browser will start in debug mode and listen on port 9222 to accept remote debugging connections.

  6. Or directly modify the shortcut:
  7. Create a shortcut for the Chrome browser, right-click and select 'Properties', add --remote-debugging-port=9222 in the 'Target' field, you can define the port yourself, and then start the browser.


macOS Operating System:

  1. Ensure that you have installed Chrome browser and it is up to date.
  2. Open the Terminal application.
  3. /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  4. Enter the following command in the terminal and press Enter:

    Chrome browser will start in debug mode and listen on port 9222 to accept remote debugging connections.

Linux Operating System:

  1. Ensure that you have installed Chrome browser and it is up to date.
  2. Open the Terminal application.
  3. google-chrome --remote-debugging-port=9222
  4. Enter the following command in the terminal and press Enter:

    Ifgoogle-chromeCommand not found, please try usinggoogle-chrome-stableor a similar command.

  5. Chrome browser will start in debug mode and listen on port 9222 to accept remote debugging connections.

Note: The above method enables remote debugging when starting Chrome browser, but please ensure that your operating system and firewall settings allow access to the specified debugging port.