This page looks best with JavaScript enabled

Running WSL2 GUI Apps in Windows 10

 ·  ☕ 3 min read

All of the answers I found online suggest using a complex workflow of installing X server, configuring RDP and connecting to your Linux box in order to run its GUI app. While this works, the approach is at least a few years old. It is no longer the most efficient way of doing it in 2023. Instead, you can use WSLg.

Introduction

WSLg is a convenient and efficient solution for running Linux GUI apps on Windows, providing better performance and compatibility than using an X server, but most importantly giving your Linux app a feel of a native Windows application, which can even be launched from the Start Menu.

Using Linux GUI Apps with WSLg - TL;DR version

  1. Update your WSL2 install:

    wsl --update
    
  2. Install your Linux app, for example GIMP:

    sudo apt install gimp
    
  3. Run it from your Start Menu. The shortcut will be automatically placed under your distro’s folder, for example Ubuntu, same as any program you install in Windows.

Notepad with GIMP running in background

You even get the icon on the taskbar:

GIMP having a proper button with the icon on the taskbar

Using Linux GUI Apps with WSLg - Full Version

  1. Ensure you have the latest version of Windows and WSL: Make sure you’re running Windows 10 version 21364 or later, or Windows 11 with WSL2 enabled.

  2. Update WSL: Open PowerShell with administrative privileges and run the following command to update the WSL kernel:

    wsl --update
    
  3. Restart WSL: WSL needs to be shut down if it was previously running. This ensures your update is applied correctly.

    wsl --shutdown
    
  4. Install a Linux distribution: If you haven’t already, install a Linux distribution, such as Ubuntu, from the Microsoft Store.

  5. Set the version to WSL2: Ensure your Linux distribution is using WSL2 by running the following command in PowerShell:

    wsl --set-version Ubuntu 2
    

    Replace Ubuntu with the name of your installed distribution.

  6. (Optional) Set the default version to WSL2: Although not required, the default version for any Linux you install is v1. If you want v2 on all Linux distros going forward, you need to run the following command before installing the image.

    wsl --set-default-version 2
    

    You can list your installed Linux distributions and check their WSL version by entering this command:

    wsl -l -v
    

    in PowerShell or Windows Command Prompt.

  7. Install the desired GUI application: Open the Ubuntu terminal in WSL2 and install the desired GUI application. For example, to install GIMP, run:

    sudo apt update
    sudo apt install gimp
    
  8. Launch the GUI application: With WSLg, any installed Linux GUI apps will automatically appear in your Windows Start menu. You can simply launch GIMP or any other Linux GUI app from there.

launch Linux GUI application from the Start Menu

Getting To This Answer

Most of the readers are likely to skip this part and it’s totally fine. I have been playing with various AI tools and since this is an interesting technical question with multiple solutions, I decided to ask the most popular chat bots and see how they respond. Here is what I found.

  • Both ChatGPT and OpenAssistant provided a solution for X server. While correct, better options are available, that are less intimidating for someone with no prior Linux experience.

  • ChatGPT knew about WSLg solution, but only offered it after I mentioned it.

  • Phind told me about WSLg solution right away, so it gets the most respect points.

The actual answer I used was from Microsoft’s WSLg Github page, so I already knew the optimal way before asking the chat bots about it.


Victor Zakharov
WRITTEN BY
Victor Zakharov
Web Developer (Angular/.NET)