Skip to content

Instantly share code, notes, and snippets.

@junielton
Last active January 22, 2026 06:29
Show Gist options
  • Select an option

  • Save junielton/8ae25f55a3e795400666cb8d372ee678 to your computer and use it in GitHub Desktop.

Select an option

Save junielton/8ae25f55a3e795400666cb8d372ee678 to your computer and use it in GitHub Desktop.
How to Run Antigravity Browser Automation on WSL2

Strategy: Bridge the WSL connection to use the native Windows Chrome installation via port forwarding. This avoids slow rendering inside Linux and utilizes your GPU.

1. Windows Setup (One-Time)

Open PowerShell as Administrator for these steps.

  1. Get your WSL Gateway IP (Run this inside your WSL terminal):

    ip route show | grep -i default | awk '{ print $3}'

    Copy this IP (e.g., 172.25.x.x). We will refer to it as GATEWAY_IP.

  2. Configure Port Forwarding (Run in PowerShell Admin, replace GATEWAY_IP):

    netsh interface portproxy add v4tov4 listenport=9222 listenaddress=GATEWAY_IP connectport=9222 connectaddress=127.0.0.1
  3. Open Firewall (Run in PowerShell Admin):

    New-NetFirewallRule -DisplayName "Chrome Remote Debug" -Direction Inbound -LocalPort 9222 -Protocol TCP -Action Allow

2. WSL Setup & Automation

Configure Linux to automatically tunnel requests to Windows.

  1. Install socat:

    sudo apt update && sudo apt install -y socat
  2. Add Auto-Connect Script: Append this block to your ~/.bashrc (or ~/.zshrc) file to ensure the tunnel starts every time you open the terminal:

    # --- Antigravity / Chrome Bridge Setup ---
    # 1. Get Windows Gateway IP dynamically
    WIN_IP=$(ip route show | grep -i default | awk '{ print $3}')
    
    # 2. Start socat in background if not already running
    if ! pgrep -f "socat TCP-LISTEN:9222" > /dev/null; then
        socat TCP-LISTEN:9222,fork,reuseaddr TCP:$WIN_IP:9222 &> /dev/null &
    fi
  3. Apply changes:

    source ~/.bashrc

3. Antigravity IDE Configuration

Go to Antigravity Settings -> Browser Subagent.

  • Chrome Binary Path: (Use the path to your Windows Chrome executable via the /mnt mount) /mnt/c/Program Files/Google/Chrome/Application/chrome.exe

  • Browser CDP Port: 9222


Troubleshooting

If automation stops working after a full PC restart, the WSL IP address might have changed.

  1. Get the new IP in WSL:
    ip route show | grep -i default | awk '{ print $3}'
  2. Update the Windows Rule (PowerShell Admin):
    netsh interface portproxy set v4tov4 listenport=9222 listenaddress=NEW_IP connectport=9222 connectaddress=127.0.0.1
@sharjeelsohail
Copy link

Thanks for this. Were you able to get the Antigravity chrome extension installed? I get a "Download error: Download interrupted" when the Antigravity Browser Subagent attempts to install.

@smith-espenrydningen
Copy link

Have the same problem as @sharjeelsohail Did you solve this?

@ariasabouri
Copy link

Thanks a lot, that worked for me!!!

@greg-mcnamara-datacom
Copy link

Hi @sharjeelsohail @smith-espenrydningen I have the same download error message. Did you manage to solve this?

@sharjeelsohail
Copy link

sharjeelsohail commented Dec 11, 2025 via email

@smith-espenrydningen
Copy link

@sharjeelsohail - Thanks for the update. I did actually the same. It's a pity because I think working in WSL has some advantages

@bytecod3r-m
Copy link

it worked for me, thank you

@greg-mcnamara-datacom
Copy link

Hi @sharjeelsohail @smith-espenrydningen I'm not sure if it's fully working yet, but it looks like the problem was the Chrome profile. I believe Antigravity is supposed to create a new profile for the extension to be installed in, but it was trying to install in my default profile and failing. When I created a new profile and switched to it when Antigravity launched the browser, I was able to install the extension. I changed the path to the Antigravity Chrome profile in Antigravity settings to the Chrome for Windows profile folder for the new one I created e.g. /mnt/c/Users/[username]/AppData/Local/Google/Chrome/User Data/Profile 1 and now when I launch from Antigravity it does open a new Chrome window in that profile, but it defaults to the onboarding page asking to install the extension (already installed). I'll keep you posted on progress!

@inspiration88
Copy link

inspiration88 commented Dec 12, 2025

Has anyone solved when connecting through windows > connect to wsl (using antigravity) that after some decent usage it appears Reconnecting to remote authority and Antigravity begins freezing terribly?

@iZuminnnn
Copy link

iZuminnnn commented Dec 15, 2025

Thank you, it worked for me.

@jangaraj
Copy link

I think this port forwarding may works. But WSL networ mirroring will be simpler solution. Source: https://medium.com/google-cloud/working-with-google-antigravity-in-wsl-944c96c949f3
TL;DR, open %userprofile%\.wslconfig and add an entry like this:

[wsl2]
networkingMode=mirrored

Restart wsl

@iZuminnnn
Copy link

I think this port forwarding may works. But WSL networ mirroring will be simpler solution. Source: https://medium.com/google-cloud/working-with-google-antigravity-in-wsl-944c96c949f3 TL;DR, open %userprofile%\.wslconfig and add an entry like this:

[wsl2]
networkingMode=mirrored

Restart wsl

Some version window not support it

@Bioanalytica
Copy link

I tried all these but none of them worked. Either one or more of the WSL extensions: Antigravity, VS Code, or the Browser Tool would stop functioning. I finally got all three to work simultaneously:

Antigravity & VS Code WSL Setup Guide

Strategy: Decoupled Bridge.

Goal: Run VS Code Remote and Antigravity Agent simultaneously without breaking either Remote-WSL extension or the Windows Network Stack (HNS).

1. Prerequisites

  • WSL Config: The .wslconfig must not have networkingMode=mirrored.

    • Location: C:\Users\bioan\.wslconfig

    • Correct State: Empty or just memory/processor limits.

  • Chrome State: Chrome must be completely closed before starting a debug session.

    • taskkill /F /IM chrome.exe /T

2. One-Time Setup

A. Create the "Pacifier" Script (WSL)

This prevents the Agent from spawning processes and crashing memory (OOM).

  1. Create file ~/dummy-browser.sh:

    #!/bin/bash
    echo "DevTools listening on ws://127.0.0.1:9222/devtools/browser/fake-uuid"
    sleep 365d
  2. Make executable: chmod +x ~/dummy-browser.sh

B. Configure Antigravity Agent

In the IDE Settings:

  • Browser Binary Path: /home/vin/dummy-browser.sh

  • Browser CDP Port: 9222

C. Create the Chrome Launcher (Windows)

Create C:\Users\bioan\.antigravity\antigravity_chrome.bat:

@echo off
set CHROME="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
if not exist %CHROME% set CHROME="C:\Program Files\Google\Chrome\Application\chrome.exe"
:: Launches standard Chrome on Localhost (127.0.0.1)
%CHROME% --remote-debugging-port=9222 --user-data-dir="C:\AntigravityProfile" --no-first-run

3. Launch Routine (Start a Session)

Perform these steps whenever you restart your computer or the network stack resets.

Step 1: Identify the Link IP

We need to bridge the specific IP that WSL uses to talk to Windows.

  1. Open VS Code Terminal (WSL).

  2. Run: ip route show | grep -i default | awk '{ print $3}'

  3. Copy this IP (e.g., 172.29.112.1). We call this GATEWAY_IP.

Step 2: Build the Windows Bridge (PowerShell Admin)

This forces Windows to catch traffic from WSL and hand it to Chrome.

Replace GATEWAY_IP with the IP copied above.

# 1. Reset old rules
netsh interface portproxy reset

# 2. Forward WSL Gateway -> Chrome Localhost
netsh interface portproxy add v4tov4 listenaddress=GATEWAY_IP listenport=9222 connectaddress=127.0.0.1 connectport=9222

# 3. Punch Firewall (Force Open)
New-NetFirewallRule -DisplayName "Antigravity Bridge" -Direction Inbound -LocalPort 9222 -Protocol TCP -Action Allow -Profile Any -LocalAddress GATEWAY_IP

Step 3: Launch Chrome (Windows)

Run the batch script: C:\Users\bioan\.antigravity\antigravity_chrome.bat.

(Chrome will open empty. Do not close it).

Step 4: Start the Tunnel (WSL)

In VS Code Terminal, run socat to bridge the gap.

Replace GATEWAY_IP with the IP from Step 1.

# Ensure no old tunnels are blocking the port
killall socat

# Start Tunnel
socat TCP-LISTEN:9222,fork,reuseaddr TCP:GATEWAY_IP:9222 &

4. Verification

Run this inside WSL. It must return JSON to confirm the chain is unbroken.

curl http://localhost:9222/json/version

If JSON returns: You are ready. Open the Antigravity Agent and run the browser tool task.

@bob35682
Copy link

It blows my mind a 4,000,000,000,000-dollar company didn't do basic QA on WSL before releasing their product.

@ripixel
Copy link

ripixel commented Jan 12, 2026

I had lots of issues with this, but I think they all pretty much stemmed from blummin' svchost taking up 9222.
I've now got this working (thanks OP for the dummy browser knowledge!), as well as not having to rely on WSL2 mirroring/port forwarding: https://gist.github.com/ripixel/4b68f64ed1035a58abb961269bf12ad4

@amitb0ra
Copy link

to resolve "Download error: Download interrupted", open agent manager from windows instead of wsl
@sharjeelsohail

@mutumagitonga
Copy link

@amitb0ra In the testing chrome browser, load the extension manually as seen in this image
image to solve the download error.

@mutumagitonga
Copy link

@ripixel Thanks your guide has worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment