The Gem Struggle2021-05-13 | 2 mins | Bob
tags: coding, linux, guide
As you probably know, I’ve been using Jekyll for this website for a while now. It works beautifully and I’m confident that I will stay with it for quite some years. Recently I set up a new system on my computer and had to reinstall some things, including my setup for Ruby, which is the language behind Jekyll. And man, it was a struggle. Either I’m an incompetent developer, or the Ruby-Gem ecosystem is very complex and fragile. It took me hours to finish the setup to run Jekyll successfully.
Maybe you came here because you also had problems, so this hopefully helps you. Or you are a pro and know exactly what to do – if so, go ahead and throw corrections into the comments below. Here is what I’ve done in the end (I’m running Manjaro 21 Ornara).
- Don’t forget to update your system!
sudo pacman -Suy
- Install the latest Ruby and Git version:
sudo pacman -S ruby git
- Make sure the ruby installation (check the version first) is in your PATH by adding this line to your
ruby -v vi ~/.bashrc
# # ~/.bashrc # ... export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
Refer to this guide to install the Ruby Version Manager.
- Install and switch to your preferred Ruby version, for example:
rvm install 2.6.5
- Normally, you would now install Jekyll via
gem install jekyll, but somehow it won’t be recognised as installed. So I used Yaourt instead, which had to be installed first:
git clone https://aur.archlinux.org/package-query.git cd package-query makepkg -si cd .. git clone https://aur.archlinux.org/yaourt.git cd yaourt makepkg -si cd ..
- Then Jekyll can be installed:
This took quite a while as a lot of dependencies required manual confirmation as the packages are often only community versions.
- The Bundler didn’t come with it, but it can be installed via Gem:
gem install bundler
- Now, the dependencies specific to a project can be installed from the respective directory:
cd path/to/project bundle install
- Everything should be ready now, and your Jekyll site can be build and served:
bundle exec jekyll serve
If this guide didn’t help you, don’t worry – I can still use it myself when I have to reinstall everything in a few months.