Chrome Remote Debugging — Complete Guide
In this tutorial, you'll learn about Chrome Remote Debugging. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Hook
You start Chrome with --remote-debugging-port=9222 and try to connect from another instance or a DevTools frontend like chrome://inspect. The page shows "No devices detected" or "Connection refused." You know it should work but nothing appears.
The Wrong Way
Starting Chrome with --remote-debugging-port=9222 but also running a separate Chrome instance for regular browsing — only one Chrome instance can bind to a given debugging port.
# BAD: Multiple Chrome instances on the same port
google-chrome --remote-debugging-port=9222 &
google-chrome --remote-debugging-port=9222 &
Second Chrome instance: "Unable to attach — port already in use"
Only the first instance is debuggable
The second instance uses a random port
Multiple Chrome instances cannot share the same debugging port.
The Right Way
Use a single Chrome instance and verify the debugging endpoint.
# 1. Close all Chrome instances
killall chrome
# 2. Start Chrome with remote debugging enabled
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# 3. Verify the debugging endpoint is accessible
curl -s http://localhost:9222/json/version | python3 -m json.tool
{
"Browser": "Chrome/126.0.0.0",
"User-Agent": "Mozilla/5.0 ...",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/browser/abc123"
}
# 4. Check chrome://inspect on your regular Chrome
# Open chrome://inspect → "Discover network targets" → Configure
# Add: localhost:9222
# 5. For remote debugging over the network:
# Start Chrome with --remote-debugging-address=0.0.0.0 (use carefully)
# Ensure port 9222 is not blocked by firewall
# 6. Connect with standalone DevTools frontend
# https://chrome-devtools-frontend.appspot.com/
# Or use VS Code's "Debug: Open Link" with ws://localhost:9222/... URL
chrome://inspect shows the remote instance ✓
DevTools connects to all tabs ✓
Prevention
- Use a dedicated user data dir for remote debugging (
--user-data-dir=/tmp/chrome-debug). - Keep the debugging session isolated from your main browsing profile.
- Close the debugging Chrome instance when not in use.
- Use
--remote-debugging-address=127.0.0.1(default) for local debugging only. - Check system firewall rules if connecting from another machine.
Common Mistakes with remote debugging
- Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
- Using
returnto exit a function early instead of wrapping a pure value in the monad - Mixing let bindings with <- bindings in do notation, producing type errors
These mistakes appear frequently in real-world CHROME code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
DodaTech — remote debugging without the remote hassle.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro