I have a functioning Cygwin installation on my Windows 10 device (a Surface 3, in case that matters), including a functioning Xorg windowing environment. I've just begun to experiment with with the Windows Subsystem for Linux, as well. It seems like the advice for running GUI applications from WSL is to install another X server. Usually Xming is recommended, but I haven't seen any suggestions that Cygwin shouldn't work.

However, the simple way fails:

WSL $ export DISPLAY=:0
WSL $ emacs &
Display :0 unavailable, simulating -nw

I suspected it might be a networking issue, because of

WSL $ telnet localhost 6000
telnet: Unable to connect to remote host: Connection refused
WSL $ /sbin/ifconfig
Warning: cannot open /proc/net/dev (No such file or directory). Limited output.
WSL $ # there was no output at all, actually

... but ssh to a remote machine works fine, and apparently Xservers have stopped listening on port 6000 since the last time I debugged one.

I tried running cygwin $ xhost +localhost, only to discover that xhost isn't currently installed there. Which might be the next thing to try, or might be a wild goose chase --- xhost (or at least, a naked xhost +) was mostly discouraged the last time I debugged an X server.

Is there some fundamental flaw preventing WSL from using the Cygwin X server? If not, how shall I proceed?

  • 1
    Since you're using a high DPI device (the Surface 3), this extra trick might be useful to you. You can increase the font size, window size, etc, shown by changing what CygwinX thinks the screen DPI is. Edit /etc/X11/Xresources and change the Xft.dpi default from 96. Your display should be 214 DPI, so text must look quite tiny through CygwinX. Regardless, you can tweak that DPI value to change the scaling to your liking. (Just restart CygwinX between changes.) – Chris Nov 1 '18 at 2:06

You need to tell Cygwin/X to listen to TCP, which it does not do by default. You do this by passing the option -listen tcp to XLaunch. When you do this, it works really fine. I do actually prefer Cygwin/X to Xming. More details in the manual.

Find the shortcut that you're using to start Cygwin/X. (Per-user startup shortcuts are in C:\Users\<you>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, while system-wide startup shortcuts are in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp. Open the "Properties" of this link, and change the target from

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin"


C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin -- -listen tcp"

For xauth support, you should copy ~/.Xauthority from your Cygwin's home dir to your WSL's home dir.

Or if you wish to disable xauth, you can edit Cygwin's /usr/bin/startxwin, changing the appropriate line near the top to enable_xauth=0.

  • It worked to me by adding -listen tcp to the field of the panel of XLaunch when I clicked the XLaunch in the Start menu. I could not modify the property with the menu item to change the command line argument. – Yu Shen Jan 3 '20 at 19:14

You have to start the X server with startx. If you don't have X Windows installed, run the Cygwin setup.exe and select all of the X Windows systems and a window manager.

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.