Upgrade to Ruby 3 - tutorial

Hi fellow Jekyll devs. :wave:

There have been a bunch of topics asking for help on upgrading to Ruby 3 since it came out in December 2020. :gem: :rocket:

I finally made the change to Ruby 3. Today, I put together instructions for macOS and Linux.

In particular, my last post in the series covers how to rebuild your gems and add a missing webrick dependency to stop your Jekyll sites from breaking on Ruby 3.

Related forum topics

Around Ruby 3 and the Webrick error

1 Like

Thanks again @MichaelCurrin , as i was this morning thinking about this issueā€¦ telepathy ? Will do the switch to Ruby 3 and come back with some feedback.

BTW, are you noticing major changes ? what about the so called ā€™ 3x3 ā€™ promiseā€¦ in terms of ā€˜speed / performanceā€™ ?

1 Like

I have been meaning to write about for few days and today was the day Iā€™d decided to do it

I havenā€™t checked on times. Update - I just checked now and one of my sites that takes 2 min to build (cookbook) still takes 2 min.

Run Jekyll with the --profile flag if you want to see timing on a detailed level

Thank you for sharing this, Michael! Excellent articles as always! I do have a new question to ask, but will do so with a new topic, as it relates directly to configuring Jekyll with Ruby 3.0.1.

1 Like

Okey, i went the rvm path ā€¦ accordingly to my own environment.

Suffered the ā€˜no Webrickā€™ bundled ā€¦ issue, like others did,

but thanks to info shared here i was just able to quickly fix it, as @MichaelCurrin mentioned,

$ bundle add webrick

and to keep it future-proof , this automatically adds the following to Gemfile

gem "webrick", "~> 1.7"

Enjoy renewed Ruby 3

Still, in some of the websites i develop, iā€™m encountering some issuesā€¦ leading to Webrick no being available, even if apparently it got as described in this discussion here. Umfā€¦need further investigation from my side, iā€™m afraid of.

2 Likes

Hello :slight_smile: I am new to learning Jekyll and only just installed Jekyll and Ruby and therefor have the latest versions installed. I also get the webrick issue and can fix it by adding the ā€œbundle add webrickā€ command to every project.

But Iā€™m not sure how to fix this so I donā€™t have to manually add the bundle everytime after running ā€œjekyll new ****ā€. Whatā€™s the best way to fix this if youā€™re not upgrading?

thank you

Hi @O.digital

Eventually the Jekyll template created with jekyll new might include that, but while not everyone uses Ruby 3 itā€™s not essential. I understand your frustration though.

Iā€™d say use my template to make a new repo on GitHub and then clone your new repo.

My template is based closely on the output of jekyll new but with some added benefits. Notably - webrick is added to Gemfile so if you do bundle install youā€™ll get webrick

1 Like

Thanks Michael! Only working with HTML and CSS till now I just found it a bit confusing that Jekyll doesnā€™t work / wonā€™t start the server if you just follow the basic instructions to get it up and running, especially if youā€™re also new to the command line :smiley:

Just so I got the concept down: instead of running Jekyll new, itā€™s better to just clone a Github repo and then run the bundle command to install all the dependencies?

I tried to do that and got the following error
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:308:in check_for_activated_spec!': You have already activated i18n 1.12.0, but your Gemfile requires i18n 0.9.5. Prepending bundle exec` to your command may solve this. (Gem::LoadError

Guess I should just create my own Repo and clone that right?

If your site is really simple like a handful of pages and you want to use a plain CSS theme instead of a Jekyll theme, you can try making your site without Jekyll.

So that would be a repo with an index.html file in it and nothing else is needed.

You can use a static server extension in VS Code to serve your contents locally without using the CLI. Or for CLI, use a server in Python or Node or PHP.


Yes my suggestion is to use the cloned repo generated from a template, instead of using jekyll new. As the template will come with the webrick stuff every time to save you that, plus some other nice things in my template.


Oh did you something like this alone?

jekyll new
# OR 
jekyll serve

That requires having Jekyll installed globally.

Rather do this:

git clone ......../my-new-repo
cd my-new-repo
bundle install
bundle exec jekyll serve

Here is an alternative Jekyll template I made that is even simpler than the auto-generated one, if you want to get your head around Jekyll

1 Like