12

I'm using WSL on Windows 10. I've installed gtkwave through the terminal, but I am unable to run it. My system gives me the following error:

Could not initialize GTK!  Is DISPLAY env var/xhost set?

I've tried installing xhost, but running xhost +LOCAL: only gives this error:

xhost:  unable to open display ":0"

How can I fix this and run GTK GUIs?

Zanna
  • 72,312
namila007
  • 241

2 Answers2

16

WSL doesn't come with an X server by default, because Windows doesn't use an X server. Which would also be why xhost failed to do anything remotely useful.

In order to do something like this, you need to download an X server for Windows, and then configure that. For example, you can use the Xming project to run a display server. When launching Xming, you can use the -multiwindow option to make it so you don't have a virtual desktop. However, this may not be the case with other X servers present on Windows.

You can find a quick tutorial here for Xming specifically (really, it's just install + configure + export DISPLAY=:0) or here also for Xming. Alternatively you can use MobaXTerm (tutorial), which will achieve the same basic result.

In short, find an X server you like, and install it on Windows. After that, your WSL instance should be able to pick up on the fact that an X server is available, and you should be able to run GUI-based programs without much hassle.

Zanna
  • 72,312
Kaz Wolfe
  • 34,680
0

As of today, WSL should be able to run GTK software. If not, try updating your WSL from cmd/powershell.

wsl --update
willnode
  • 101