Connect to Ganache GUI from WSL2

I am attempting to connect to Ganache GUI from WSL2 but assume that I have a firewall setting that is blocking the connection.

Has anyone set this up and has any advice?


@abcoathup unfortunately, I don’t have much insight on this. I still use WSL as I haven’t had time to upgrade to WSL2.

Also, I haven’t used Ganache GUI since early this year. After learning that I could fork mainnet with Ganache CLI, I completely switched to that and removed the GUI.

I’m curious, how are you trying to connect the GUI to your WSL2 terminal? Is there an option for this in the GUI?

From what I recall when I was using the GUI, I always used a config file in my project directory that connected to the same port as the GUI for development. This was usually handled in a Truffle config file. I think the GUI defaults to port 7545, but should be visible on the GUI.

Or are you talking about interacting with the GUI directly from WSL2 without a config file or project directory? I’ve always had a project directory with web3.js or ethers.js installed to interact with the blockchain. Maybe you could install globally but I’ve never done this. If you have access to either of these libraries in the terminal though you can instantiate an instance of web3 and specify your provider in WSL2. For a local Ganache instance, this would be something like

var Web3 = require('web3');
var web3 = new Web3('http://localhost:7545');
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));

Not sure if this is very helpful. I’d love to help more if I can, but I just need more details on how you’re trying to connect the two.

1 Like

Here are some resources I found on this:

1 Like

Hi @Jshanks21,

I have Ganache GUI installed on Windows and was trying to access from WSL2.

I don’t have any issues connecting to ganache-cli running on WSL2 so assume it is a firewall issue from node on WSL2 to Ganache GUI on Windows.

I had wondered if you had managed to set this up. Thanks for all the links.

I will probably just use node on Windows to connect to Ganache GUI on Windows until I get a chance to investigate further.

1 Like

Hi @Jshanks21,

I just tried a DuckDuckGo search for “ganache gui on wsl” and this post is the top search result :smile:

1 Like

Hahaha glad to know we’re blazing a trail with this one @abcoathup

1 Like

Did you guys find any solution on how to use Ganache gui with wsl2. I only found this thread searching the internet.
Wsl2 is a great initiative by windows and it feels same as ubuntu speeds if your source code resides on ubuntu file system more than on the windows files (/mnt/c/Documents) . Wsl2 doesnt allow linux gui as of now. I found this article on how to setup linux gui in wsl2 but I didnt want to experiment with my new laptop.

Any help is greatly appreciated.

1 Like

Hi @godfather,

Welcome to the community :wave:

I haven’t found/tried a solution. I am also reluctant to mess to much with my setup in case I kill my ability to work.

One option appears to be to use RDP and run a desktop on Linux. I don’t know what the experience would be like though: