Jekyll on Ruby 2.7 on Windows: Installation

This started due to something on Twitter where someone questioned if Ruby + Windows + Jekyll was still viable in 2020. Since I had just set up Ruby 2.7, I decided to give it a spin after suggesting that I didn’t think that there will be a problem!

So, here goes. The short version is that it seems to work fine, but your mileage may vary.

You need to get the Ruby 2.7 installer from the RubyInstaller for Windows site, and set it up. Get the version with Devkit (either 32-bit or 64-bit, depending on your system). Set up the Devkit with MSYS2 as it offers you. Once it is installed, you should be good to get started.

Installing Jekyll

No magic here – start the Command Window with Ruby. If you’re using Pik, make sure you pick Ruby 2.7. Do a quick check that you’re on Ruby 2.7 by doing ruby -v and seeing that it returns something like ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32].

Next, just do gem install jekyll – I’m dumping the entire output here since it sometimes help you debug if something goes wrong.

E:\blog>gem install jekyll
Fetching addressable-2.7.0.gem
Fetching colorator-1.1.0.gem
Fetching http_parser.rb-0.6.0.gem
Fetching eventmachine-1.2.7-x64-mingw32.gem
Fetching em-websocket-0.5.1.gem
Fetching public_suffix-4.0.3.gem
Fetching ffi-1.12.2-x64-mingw32.gem
Fetching sassc-2.2.1-x64-mingw32.gem
Fetching jekyll-sass-converter-2.1.0.gem
Fetching rb-fsevent-0.10.3.gem
Fetching rb-inotify-0.10.1.gem
Fetching listen-3.2.1.gem
Fetching jekyll-watch-2.2.1.gem
Fetching kramdown-2.1.0.gem
Fetching kramdown-parser-gfm-1.1.0.gem
Fetching liquid-4.0.3.gem
Fetching unicode-display_width-1.6.1.gem
Fetching mercenary-0.3.6.gem
Fetching forwardable-extended-2.6.0.gem
Fetching pathutil-0.16.2.gem
Fetching rouge-3.16.0.gem
Fetching safe_yaml-1.0.5.gem
Fetching jekyll-4.0.0.gem
Fetching terminal-table-1.8.0.gem
Successfully installed public_suffix-4.0.3
Successfully installed addressable-2.7.0
Successfully installed colorator-1.1.0
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed http_parser.rb-0.6.0
Successfully installed eventmachine-1.2.7-x64-mingw32
Successfully installed em-websocket-0.5.1
Successfully installed ffi-1.12.2-x64-mingw32
Successfully installed sassc-2.2.1-x64-mingw32
Successfully installed jekyll-sass-converter-2.1.0
Successfully installed rb-fsevent-0.10.3
Successfully installed rb-inotify-0.10.1
Successfully installed listen-3.2.1
Successfully installed jekyll-watch-2.2.1
Successfully installed kramdown-2.1.0
Successfully installed kramdown-parser-gfm-1.1.0
Successfully installed liquid-4.0.3
Successfully installed mercenary-0.3.6
Successfully installed forwardable-extended-2.6.0
Successfully installed pathutil-0.16.2
Successfully installed rouge-3.16.0
Successfully installed safe_yaml-1.0.5
Successfully installed unicode-display_width-1.6.1
Successfully installed terminal-table-1.8.0
-------------------------------------------------------------------------------------
Jekyll 4.0 comes with some major changes, notably:

-------------------------------------------------------------------------------------
Successfully installed jekyll-4.0.0
Parsing documentation for public_suffix-4.0.3
Installing ri documentation for public_suffix-4.0.3
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for colorator-1.1.0
Installing ri documentation for colorator-1.1.0
Parsing documentation for http_parser.rb-0.6.0
unknown encoding name "chunked\r\n\r\n25" for ext/ruby_http_parser/vendor/http-parser-java/tools/parse_tests.rb, skipping
Installing ri documentation for http_parser.rb-0.6.0
Parsing documentation for eventmachine-1.2.7-x64-mingw32
Installing ri documentation for eventmachine-1.2.7-x64-mingw32
Parsing documentation for em-websocket-0.5.1
Installing ri documentation for em-websocket-0.5.1
Parsing documentation for ffi-1.12.2-x64-mingw32
Installing ri documentation for ffi-1.12.2-x64-mingw32
Parsing documentation for sassc-2.2.1-x64-mingw32
Installing ri documentation for sassc-2.2.1-x64-mingw32
Parsing documentation for jekyll-sass-converter-2.1.0
Installing ri documentation for jekyll-sass-converter-2.1.0
Parsing documentation for rb-fsevent-0.10.3
Installing ri documentation for rb-fsevent-0.10.3
Parsing documentation for rb-inotify-0.10.1
Installing ri documentation for rb-inotify-0.10.1
Parsing documentation for listen-3.2.1
Installing ri documentation for listen-3.2.1
Parsing documentation for jekyll-watch-2.2.1
Installing ri documentation for jekyll-watch-2.2.1
Parsing documentation for kramdown-2.1.0
Installing ri documentation for kramdown-2.1.0
Parsing documentation for kramdown-parser-gfm-1.1.0
Installing ri documentation for kramdown-parser-gfm-1.1.0
Parsing documentation for liquid-4.0.3
Installing ri documentation for liquid-4.0.3
Parsing documentation for mercenary-0.3.6
Installing ri documentation for mercenary-0.3.6
Parsing documentation for forwardable-extended-2.6.0
Installing ri documentation for forwardable-extended-2.6.0
Parsing documentation for pathutil-0.16.2
Installing ri documentation for pathutil-0.16.2
Parsing documentation for rouge-3.16.0
Installing ri documentation for rouge-3.16.0
Parsing documentation for safe_yaml-1.0.5
Installing ri documentation for safe_yaml-1.0.5
Parsing documentation for unicode-display_width-1.6.1
Installing ri documentation for unicode-display_width-1.6.1
Parsing documentation for terminal-table-1.8.0
Installing ri documentation for terminal-table-1.8.0
Parsing documentation for jekyll-4.0.0
Installing ri documentation for jekyll-4.0.0
Done installing documentation for public_suffix, addressable, colorator, http_parser.rb, eventmachine, em-websocket, ffi, sassc, jekyll-sass-converter, rb-fsevent, rb-inotify, listen, jekyll-watch, kramdown, kramdown-parser-gfm, liquid, mercenary, forwardable-extended, pathutil, rouge, safe_yaml, unicode-display_width, terminal-table, jekyll after 54 seconds

As you can see, it seems to just work! Let’s see if it runs. If you don’t already have it, also install bundler.

Running Jekyll

Once this was done, I decided to follow the step by step tutorial on the Jekyll website.

Step 1: Create a Gemfile and run bundler

E:\blog>bundle init
Writing new Gemfile to E:/blog/jekyll/step/Gemfile

E:\blog>bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using public_suffix 4.0.3
Using addressable 2.7.0
Using bundler 2.1.4
Using colorator 1.1.0
Using concurrent-ruby 1.1.6
Using eventmachine 1.2.7 (x64-mingw32)
Using http_parser.rb 0.6.0
Using em-websocket 0.5.1
Using ffi 1.12.2 (x64-mingw32)
Using forwardable-extended 2.6.0
Using i18n 1.8.2
Using sassc 2.2.1 (x64-mingw32)
Using jekyll-sass-converter 2.1.0
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.1
Using listen 3.2.1
Using jekyll-watch 2.2.1
Using kramdown 2.1.0
Using kramdown-parser-gfm 1.1.0
Using liquid 4.0.3
Using mercenary 0.3.6
Using pathutil 0.16.2
Using rouge 3.16.0
Using safe_yaml 1.0.5
Using unicode-display_width 1.6.1
Using terminal-table 1.8.0
Using jekyll 4.0.0
Bundle complete! 1 Gemfile dependency, 27 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Step 2 – Create a file and build your site

The tutorial goes on to suggest a directory called root and then add an index.html file there. Once that is done, go into that directory and you can build your site by doing bundle exec jekyll build

E:\blog>cd root

E:\blog\root>bundle exec jekyll build
Configuration file: none
            Source: E:/blog/jekyll/step/root
       Destination: E:/blog/jekyll/step/root/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 0.033 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

Step 3 – Take a look at the site

Now, you can get it up by doing bundle exec jekyll serve to serve the site. This starts a server that shows you the site on http://localhost:4000 – start a browser and take a look.

E:\blog\root>bundle exec jekyll serve
Configuration file: none
            Source: E:/blog/jekyll/step/root
       Destination: E:/blog/jekyll/step/root/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 0.04 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled for 'E:/blog/jekyll/step/root'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

Step 4 – Follow the rest of the tutorial

From here on, you should be able to go through the rest of the tutorial. I didn’t do that.

Updating my site

Instead of getting into Step 4, I went to my existing blog that is set up with Ruby 2.2 and decided to give it a whirl instead with the new Jekyll + Ruby.

I went in to that site and did a bundle install after removing the Gemfile.lock.

So, I ran into the first problem when I did this – Nokogiri failed to install. A release is pending which will make Nokogiri work on the release version of Ruby 2.7. For me, this was included by gem 'github-pages' in my Gemfile. I commented that out first to get a move on. Then, I did

Since I ended up moving to Jekyll 4.0 in this installation (and want to try to weather it out), I got a lot of errors!

So, this is the first thing I saw:

E:\blog\jekyll\uno>bundle exec jekyll build
Requiring backports/<ruby version> is deprecated. Require just the needed backports instead
Rails backports are deprecated.
Configuration file: E:/blog/jekyll/uno/_config.yml
       Deprecation: You appear to have pagination turned on, but you haven't included the `jekyll-paginate` gem. Ensure you have `plugins: [jekyll-paginate]` in your configuration file.

This looked easier to handle. Added gem 'jekyll-paginate', group: :jekyll_plugins to the Gemfile and bundle install.

I also got a lot of these:

C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.0.0/lib/jekyll/convertible.rb:41: warning: Using the last argument as keyword parameters is deprecated

Right now, I will ignore these.

The Problem with Textile

I am a big fan of Textile Markup, and in Ruby, this uses the RedCloth gem. However, on Windows, converting posts written in Textile kept failing for me. I need to get into this a bit more, but for now, it seems that if you’re only using Markdown, you should be fine!

I have submitted a simple fix in a pull request for the loading problem for RedCloth – if it gets merged, then the updated gem should be able to work fine on Ruby 2.7. Alternatively, you could make a small change to a single file in your gem installation and it will work for you. For now, follow the pull request – if it doesn’t get merged in some time, I will write up the change separately; or ask in the comments below.

So, what is next?

That really depends on you. I started the blog with the first few posts being about setting up Jekyll with IBM Cloud – if that’s where you want to go, take a look. I also have some other posts about Jekyll – so, feel free to explore!

Maybe, Ruby 2.7 is too new and we need to give it a bit of time for popular libraries (e.g. Nokogiri) to be available for it. Everything worked fine for me on Ruby 2.2 – maybe, it’s time to try JRuby or Ruby 2.6 again when there is a bit of time.

Links and References

Here are the main links:

  • Jekyll Website: https://jekyllrb.com/
  • Download Ruby: https://rubyinstaller.org/
comments powered by Disqus