Using WSL2 + Visual Studio Code for Jekyll blogging on Windows 10

Henrique Graca
3 min readSep 5, 2019

--

If you are like me and have your blog hosted on GitHub pages you are using Jekyll as your blog generation engine. Turns out that Jekyll does not support Windows so you have to do some hacking in order to make it work on Windows. In this post I will show you how to take advantage of WSL2 and Ubuntu 18.04 to install Jekyll and locally run your blog.

What is Windows Subsystem for Linux 2?

The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run native Linux command-line tools directly on Windows.

WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version). Individual Linux distros can be run either as a WSL 1 distro, or as a WSL 2 distro, can be upgraded or downgraded at any time, and you can run WSL 1 and WSL 2 distros side by side. WSL 2 uses an entirely new architecture that uses a real Linux kernel.

How to install WSL2 is documented here

Visual Studio Remote WSL

If you have VS Code already installed you will need to install the Remote WSL extension so that you are able to run linux commands and applications against your mounted Windows folder where your Jekyll blog is.

Extension is here

After the extension is installed you will see a small icon on the bottom left of VS Code

VS Code Remote icon

What I usually do is open the folder that as the blog before starting the remote session. Once I have the folder open in VS Code I click on the Remote WSL icon and are presented with the following options:

Remote WSL options

You will then choose Remote-WSL: Reopen Folder in WSL (if you had the folder opened). Once everything is finished the icon will change to:

Session established

Now open the terminal window and you will see that the context is your Ubuntu machine and the folder is a mount to your Jekyll blog folder

Installing Jekyll in WSL Ubuntu 18.04

And now you can run your blog locally in Windows 10 with the power of WSL2 and Linux without having to hack your way installing Jekyll on Windows.

--

--