How to Install Jekyll on Windows
This post shows how to install Ruby and Jekyll via Chocolatey on Windows 8.1 or Windows Server 2012 R2 Update 1.
Chocolatey
If you do not have Chocolatey, you can install it by following the instructions on chocolatey.org. You may also see this post for instructions on how to set the Chocolatey cache location.
Ruby
Install
Open PowerShell as Administrator and run the following command:
This will install Ruby 2.1.6 in C:\tools\ruby21\bin
.
Configure
Close PowerShell and open it again, so it can pick the changes to the PATH environment.
Test
Ruby DevKit (2.0+)
Install
Open PowerShell as Administrator and run the following command:
This will install Ruby DevKit 2.0+ and its dependencies- in C:\tools\DevKit2
.
Configure
Open C:\tools\DevKit2\config.yml
and add C:\tools\ruby21
path at the end. The complete config.yml
should look like this:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- C:/tools/ruby21
Run the DevKit installer:
Jekyll
Install Bundler
Create Jekyll Site
Create a jekyll
directory under your home:
Create a New Bundle
Jekyll Gem
For Jekyll we need the jekyll
gem.
Syntax Highlighter Gem
We will use rouge
as a syntax highlighter. This comes in the rouge
gem.
Auto-generation Gem
Jekyll has a built-in auto-regeneration feature that watches your source folder for changes and then re-builds your site. On Windows, you need to install the wdm
gem to enable this functionality.
Gemfile
Open the Gemfile
file and add jekyll
, rouge
, and wdm
packages. Here is the final file:
Install Gems
Install gems locally:
Create Site
Configure
Syntax Highlighter
Open ~/jekyll/site/_config.yml
. Add this line at the end to set rouge
as a syntax highlighter:
Test
Build
Serve
Open a second PowerShell window
Open a browser and navigate to http://localhost:4000
. You should see a basic Jekyll site running.
Auto-generation
Go to ~/jekyll/site
and open About.md
with a text editor capable of using UTF-8 encoding, e.g. Sublime Text. Change the title from About
to About Me
. Save the file. Refresh your browser and navigate to http://localhost:4000/about/
. You should see the page has the new About Me
title.