Search code examples
windows-subsystem-for-linuxgitk

How can I run Gitk on WSL 2?


How can I run Gitk on WSL 2?

I already installed Gitk in WSL 2.

After I installed Gitk, I tried to run it but it failed with below error log:

application-specific initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment variable
    while executing
"load /usr/lib/x86_64-linux-gnu/libtk8.6.so Tk"
    ("package ifneeded Tk 8.6.8" script)
    invoked from within
"package require Tk"
    (file "/usr/bin/gitk" line 10)

Could you help me how can run Gitk on WSL 2?


Solution

  • You can install and run gitk straight from ubuntu terminal on Windows 11, using apt install.

    I've just followed the steps from the following post and it worked: https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

    I had to update not only the graphic driver but also the WSL.

    Now, I can use either gitk or any linux app on Windows 11.