Easily install Jekyll on Windows with 3 command prompt entries and Chocolatey

UPDATE 2017/05/17:
I now recommend using the “Windows 10 Subsystem for Linux” which provides an Ubuntu bash shell, to install and use Jekyll. This is how I use it myself.
Install guide is here https://davidburela.wordpress.com/2017/05/17/how-to-install-jekyll-on-windows-10-with-windows-subsystem-for-linux/

 

I’ve been using Jekyll to create static websites on GitHub Pages, but I was unsure how to install it with dependencies I wasn’t used to (NodeJS & Ruby). Here is the easiest way to get Jekyll set up on your machine in just a couple of minutes.

TL;DR if you have Chocolatey installed the 2 commands are:

  1. choco install ruby -y
  2. gem install bundler
  3. gem install jekyll

 

Prerequisite – Chocolatey 

You need to have Chocolatey installed on your machine. Chocolatey is the BEST way to install and keep applications updated on windows.

  1. Open a command prompt with Administrator access
  2. Install Chocolatey
    @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  3. Close the command prompt as Chocolatey will not be available until you close and reopen.

Install dependencies & Jekyll

  1. Open a command prompt with Administrator access
  2. Install Ruby
    choco install ruby -y
    image
  3. Close and open a new command prompt with Administrator access
  4. Install gem bundler
    gem install bundler
  5. Install Jekyll
    gem install jekyll
    image
  6. UPDATE 2016/12/5: if you get an error about SSL, you will need to manually update Ruby Gems, because their certificate expired… Hopefully the new certificate will be bundled in the future
    http://guides.rubygems.org/ssl-certificate-update/
    image

Now you can use standard Jekyll commands to create a new site and serve it e.g.
jekyll new myblog
cd myblog
jekyll serve

 

Edits:
2016/12/05: Added details on how to get resolve the Ruby Gems certificate expiring. And added gem bundler which is a new requirement.
2015/12/05: From Jekyll 3.0 you do not need to install NodeJS. This brings it down to just 2 command prompt entries to install Jekyll

48 thoughts on “Easily install Jekyll on Windows with 3 command prompt entries and Chocolatey

  1. Hi,

    Just FYI when I tried to install ruby that way I got the error:
    C:\Windows\system32>choco install ruby
    Installing the following packages:
    ruby
    By installing you accept licenses for the packages.
    ruby not installed. The package was not found with the source(s) listed.
    If you specified a particular version and are receiving this message, it is possible that the package name exists but t
    he version does not.
    Version: “”
    Source(s): “https://chocolatey.org/api/v2/”

    Chocolatey installed 0/1 package(s). 1 package(s) failed.
    See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
    Failures:
    – ruby

    The solution was to run the following:
    choco install ruby –version=2.2.4

  2. this is a fantastic tutorial, found via: https://jekyllrb.com/docs/windows/#installation

    One thing that I’m stuck on is post installation and serve I get a warning: “please add the following to your Gemfile to avoid polling for changes: gem ‘wdm’, ‘~> 0.1.0’ if Gem.win_platform?”. The main Jekyll site also recommends this.

    What is the Gemfile, and how do I locate it locally?

  3. The title of this article is really a false advertisment. To install the Ruby, you firstneed Chocholatey. To install that you need powershell.

    The `gem` is another thing you probably need to install, but here the article author doesn’t even bother mention it.

  4. Well, thanks for the guide, this guide works fine by default. But, the mybolg is created under system32. That would be very great if you can add more guides on how to create project in other folder as there are a lot of issues if simply following the original commands.

    I tried to create it to other folder, but encountered a lot of issues. for example, I still need to install bundler, after install it, when I jekyll serve my blog, the page is empty and command message shows lots of files not found:
    Error reading file C:/Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/default.html: No such file or directory @ rb_sysopen – /Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/default.html
    Error reading file C:/Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/page.html: No such file or directory @ rb_sysopen – /Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/page.html
    Error reading file C:/Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/post.html: No such file or directory @ rb_sysopen – /Tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-1.0.1/_layouts/post.html

    Seems it is a path issue, I am an newbie on Ruby. Thanks for any advice.

  5. Thanks for posting! However it was not so “easily” for me.

    Everything went smooth until last step. But issuing “gem install jekyll” brought me this:

    ERROR: Could not find a valid gem ‘jekyll’ (>= 0), here is why:
    Unable to download data from https://rubygems.org/ – SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

    After doing some research I found the solution on the official site:
    http://guides.rubygems.org/ssl-certificate-update/

    And then you can
    7. Start using jekyll
    jekyll new

    But you get a new
    Dependency Error: Yikes! It looks like you don’t have bundler or one of its dependencies installed. In order to use Jekyll as currently configured, you’ll need to install this gem. The full error message from Ruby is: ‘cannot load such file — bundler’ If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!
    jekyll 3.3.0 | Error: bundler

    So before that
    6. Install bundler
    gem install bundler

    Hope this helps for anyone coming after me with the same problem 🙂

    • Figured it out! Thanks so much to the community for making me nerd out and solve problems. Thank you google. And thank you brain for not failing me. *accepts award*

  6. Great post! But there is a typo at the command line for Chocolatey installation.
    ‘))” is missed after install.ps1.

    @powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))” && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin”

  7. Still getting “‘jekyll’ is not recognized as an internal or external command, operable program or batch file” – any suggestions as to where I’m going wrong?

  8. It didn’t work… When I do the command “gem install jekyll” the following error appears:

    ERROR: Error installing jekyll:
    ERROR: Failed to build gem native extension.

    current directory: C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
    C:/tools/ruby30/bin/ruby.exe -I C:/tools/ruby30/lib/ruby/3.0.0 -r ./siteconf20210520-2132-gijlna.rb extconf.rb
    creating Makefile

    current directory: C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
    make DESTDIR\= clean
    C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/make-0.3.1/bin/make:4:in `’: undefined local variable or method `make’ for main:Object (NameError)
    from C:/tools/ruby30/bin/make:23:in `load’
    from C:/tools/ruby30/bin/make:23:in `’

    current directory: C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
    make DESTDIR\=
    C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/make-0.3.1/bin/make:4:in `’: undefined local variable or method `make’ for main:Object (NameError)
    from C:/tools/ruby30/bin/make:23:in `load’
    from C:/tools/ruby30/bin/make:23:in `’

    make failed, exit code 1

    Gem files will remain installed in C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/http_parser.rb-0.6.0 for inspection.
    Results logged to C:/tools/ruby30/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/http_parser.rb-0.6.0/gem_make.out]

    Can somebody help me?

Leave a comment