Jekyll and GitHub Pages on Windows

1 minute read

I use the combination of Jekyll and GitHub Pages for my blog and to make the publishing process smoother I wanted to have the same local testing experience on my Windows machine as I do on my Chromebook.

If you want to setup a Ruby environment capable of running Jekyll on a Windows 10 machine you can follow these steps.

Linux Subsystem for Windows

We will use the Linux Subsystem for Windows to run the testing environment.

Several different Linux distributions are available in the Microsoft Store, but these instructions assume the use of Ubuntu.

  1. Open an administrator Powershell prompt and run:

     Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    
  2. Restart Windows.
  3. Open the Microsoft store app and install Ubuntu.
  4. The first time you run the Ubuntu app you will have to wait a little while for some additional installation steps to complete.
  5. Provide a username and password for the Ubuntu environment when prompted.
  6. You should now have a working Ubuntu shell.

Ruby

We will be using Ruby Version Manager to easily install and manage Ruby versions. RVM has a package available for Ubuntu that makes it nice and easy to install.

  1. Ensure that your package lists are up to date by running:

     sudo apt-get update
    

    Note that the first time you use sudo in a session you will have to provide your password.

  2. Install a few prerequisites to ensure that the subsequent steps go smoothly by running:

     sudo apt-get install -y curl gnupg build-essential
     sudo apt-get install software-properties-common
    
  3. RVM can be installed easily using apt-get, but we need to reference the project’s personal package archive to do so:

     sudo apt-add-repository -y ppa:rael-gc/rvm
     sudo apt-get update
    
  4. Install RVM:

     sudo apt-get install rvm
    
  5. You will need to add your user to the rvm group before you can use rvm:

     sudo usermod -a -G rvm <yourUserNameHere>
    
  6. Restart the Ubuntu app.
  7. Install Ruby and Bundler:

     rvm install ruby
     rvm use ruby
     gem install bundler
    

Profit

You now have everything you need to build and run a Jekyll site locally from the Ubuntu shell. If you have an existing site you can simply navigate to it (you will find your Windows drive at /mnt/c) and run:

 bundle install
 bundle exec jekyll serve

If you are starting from scratch you should be able to follow the instructions to create a new GitHub Pages site.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...