Install Jekyll on Windows

What is Jekyll?

Jekyll is a set of ruby packages to make website and blog maintenance automatic. It can convert plain text files (particularly Markdown files) into static html files which then can be hosted by a web server. The most attractive feature is that Github.com uses Jekyll as the engine to host personal websites, which means that one can simply push their local plain text files to their github repositories for being demonstrated as websites (check here to see how to set up for a repository becoming a website).

It is not necessary at all to install Jekyll for hosting your website at github.com, because github.com will do the conversion (if any) for you behind the scene (though you won’t be able to see resultant files). However, to make good websites, you probably want to tweak files a lot. Then you need install Jekyll locally for testing any changes.

How to install Jekyll on Windows?

It is straightforward to install Jekyll on Linux or MacOS by following the instruction at Jekyll’s website, but it is becoming confusing to install Jekyll on Windows when multiple tutorials are found by searching google. Here I describe the steps I finally found workable on Windows 10, which should also work on other windows systems.

  1. Install Ruby: Download and install Ruby (version 2 or higher ) from http://rubyinstaller.org/downloads/. Make sure to select the option of “Add Ruby executables to your PATH” during installation, which make the program ruby.exe visible in any command line prompt.
  2. Install DevKit for Ruby: Download and install (it is acctually just decompress a zip file) the development kit (corresponding the Ruby version installed in the last step) from http://rubyinstaller.org/downloads/.
    Note that this installation provides C head and library files for compiling some Ruby packages. You may notice that the DevKit contains similar files as the MinGW installation file so have a question like: can I use the already installed MinGW on my computer instead of installing the DevKit? I tried this, but failed. So you have to install the DevKit for compiling some Jekyll-dependent packages.
  3. Associate DevKit with Ruby: Say in Step 2 the DevKit was installed into a folder named “d:\DevKit”. Open a command line tool, and type the following command to associate the devkit to the installed Ruby:
    cd d:\DevKit
    ruby dk.rb init
    ruby dk.rb review
    ruby dk.rb install
    

    If anything goes wrong when running the above commands, go to https://labs.sverrirs.com/jekyll/1x-ruby-and-devkit-error.html for a solution.

  4.  Install Jekyll and dependent packages: The simplest way is using the instruction given by github.com. Create a file ‘Gemfile’ in the current folder (where command line tool stays), and copy and paste the following text into it:
    source 'https://rubygems.org'
    gem 'github-pages', group: :jekyll_plugins
    

    Then run the following commands:

    gem install bundler
    bundle install
    

Then you are done of installing Jekyll on Windows. If something goes wrong, please send me an email or comment here, and I will try to help. With this, you can start a journey of creating websites using Jekyll.

References:
https://labs.sverrirs.com/jekyll/1-ruby-and-devkit.htmlhttps://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/