WSL2 runs Linux inside a lightweight virtual machine, which means GUI applications like Chrome live on the Windows side of a network boundary. WhenDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jacob-bd/notebooklm-mcp-cli/llms.txt
Use this file to discover all available pages before exploring further.
nlm login tries to launch a browser directly from a WSL2 terminal, the GUI process crosses that boundary in a way that can corrupt the terminal display — the screen goes black, the session becomes unresponsive, and a restart is required. The --wsl flag solves this by launching Chrome on the Windows side, routing the Chrome DevTools Protocol connection back through a Windows port proxy, and extracting cookies automatically before cleaning up.
The Problem in Detail
On a standard Linux system,nlm login opens a local Chrome window, waits for you to log in, and extracts session cookies using the Chrome DevTools Protocol (CDP) over localhost. On WSL2, the same approach causes terminal corruption because:
- Chrome is a Windows GUI application — launching it from WSL2 crosses the virtual machine boundary.
- Chrome v136+ binds its CDP debug port to
127.0.0.1only, which is the Windows loopback, not accessible from the WSL2 virtual network interface. - Without a network bridge, the WSL2 process cannot connect to Chrome’s debug port at all.
--wsl flag works around both issues: it launches Chrome on the Windows side on port 9223, and a one-time netsh port proxy forwards traffic from the WSL-accessible network interface (port 9222) to Windows localhost:9223.
One-Time Setup
Ensure Google Chrome is installed on Windows
The
--wsl flag requires Google Chrome installed on the Windows side — not inside WSL. Download it from google.com/chrome if needed.Before running nlm login --wsl, close all open Chrome windows on Windows (check the system tray too). Chrome’s remote debugging mode only works when launched fresh.Create the port proxy (elevated PowerShell)
Open PowerShell as Administrator and run:This rule persists across reboots. It forwards any connection to port 9222 on the Windows host’s network interfaces to
localhost:9223, where Chrome will be listening.Authenticate
- Detects your Windows host IP from the WSL2 default gateway.
- Checks whether the Windows Firewall rule for port 9222 is in place (and prompts with instructions if not).
- Launches
chrome.exeon the Windows side with--remote-debugging-port=9223. - Connects to Chrome via the port proxy at
<windows-ip>:9222. - Opens
notebooklm.google.comin a fresh Chrome tab. - Waits for you to complete the Google login.
- Extracts cookies via CDP, saves them to your
nlmprofile, and terminates Chrome.
If Manual mode requires no port proxy, no Chrome launch, and no network bridge.
--wsl is problematic in your environment, use manual mode instead. Export your cookies from Chrome using the Cookie-Editor extension, save the file somewhere WSL can read it, then run:Security Considerations
The port proxy approach introduces a temporary network exposure on port 9222. The following mitigations are in place:- Chrome binds to localhost only (v136+). Chrome never listens on the public network interface — only on
127.0.0.1:9223on the Windows side. - Port proxy forwards to localhost only. The
netshrule forwards toconnectaddress=127.0.0.1, so the proxy cannot be redirected to an external host. - Temporary Chrome profiles. Each
nlm login --wslrun creates a fresh, isolated Chrome profile in a temporary Windows directory that is cleaned up after authentication completes. - Short-lived exposure. The remote debug port is only active during the
nlm login --wslcommand. Once cookies are extracted, Chrome is terminated and port 9223 is no longer listening. - Windows Firewall restriction. The firewall rule created by
nlm login --wslrestricts inbound connections on port 9222 toLocalSubnet— the WSL2 virtual network — blocking connections from external network hosts.
Comparison: Native Linux vs WSL2
| Feature | Native Linux | WSL2 |
|---|---|---|
| Chrome launch | Direct GUI | Cross VM boundary — use --wsl |
| Terminal safety | ✅ Safe with direct launch | ⚠️ Requires --wsl flag |
| Cookie extraction method | CDP over localhost | CDP over WSL↔Windows network bridge |
| Port proxy required | No | Yes (one-time netsh setup) |
| Profile persistence | ✅ Yes | ✅ Yes |
Troubleshooting
Chrome did not start within 30 seconds
Chrome did not start within 30 seconds
This almost always means Chrome was already running when Also verify the firewall rule was created:
nlm login --wsl tried to launch a fresh instance. Chrome’s remote debugging mode only works when started from scratch.Fix:- Close all Chrome windows on Windows (including any minimized to the system tray).
- Open Task Manager and check for lingering
chrome.exeprocesses — terminate them. - Retry
nlm login --wsl.
Chrome not found on Windows side
Chrome not found on Windows side
The Option B — Use manual mode:Export cookies from Chrome using the Cookie-Editor browser extension, save the file, then:You can also set the
--wsl flag looks for Chrome in two standard locations:C:\Program Files\Google\Chrome\Application\chrome.exeC:\Program Files (x86)\Google\Chrome\Application\chrome.exe
NLM_CHROME_PATH environment variable to point directly to your Chrome binary:Could not determine Windows host IP
Could not determine Windows host IP
nlm login --wsl reads the Windows host IP from the WSL2 default gateway in /etc/resolv.conf. If your WSL2 networking is in a non-standard mode (e.g., mirrored networking), this lookup may fail.Check the resolv.conf entry:nameserver 172.20.x.x. If the file is empty or missing, your WSL2 networking is configured differently.Manual workaround:Terminal still goes black after using --wsl
Terminal still goes black after using --wsl
If This approach requires no Chrome launch from WSL and no port proxy.
--wsl still causes display issues in your terminal emulator, fall back to fully manual cookie extraction:- Open Chrome on Windows and navigate to
notebooklm.google.com. - Install the Cookie-Editor browser extension.
- Export cookies to a JSON or header file.
- Save to a path accessible from WSL (e.g.,
C:\Users\<name>\Downloads\cookies.txt). - Import with: