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?


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.

  • thanks for the reply ,i ran mobaxterm and then set the Displayport export DISPLAY=localhost:0.0 ,then GTK worked .thanks again :) – namila007 Mar 28 '17 at 19:08
  • @namila007 No problem! Oh, by the way, welcome to Ask Ubuntu. I hope you enjoy your stay here. Might I also suggest you visit our tour? It's a great way for new users to get quickly familiarized with the site, and to get a free badge. – Kaz Wolfe Mar 28 '17 at 19:11
  • 1
    thanks,sure im gonna stay here coz i started using ubuntu(kubuntu) recently . i already visited it .thankyou :) – namila007 Mar 28 '17 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.