Jekyll article illustration.

How to install Jekyll on macOS?

Jekyll is a static site generator, it will help you transform your plain text into static websites and blogs. I had a few errors when installing it, so here is a quick tutorial on how to install it on macos and start your Jekyll based site. Tested on macOS Sierra (v10.12).

You can check first the official documentation on how to install Jekyll on macOS (). It did not work for me, for a couple of reasons I will explain bellow.

The main command line to install Jekyll is:

$ sudo gem install jekyll

This did not work for me, as it resulted in an error message.

"ERROR:  While executing gem ... (Errno::EPERM)     Operation not permitted - /usr/bin/safe_yaml"

After some digging, it seem that macOS changed the permission system on /usr/bin, so now if you want execute that command you need to provide the location as parameter. Execute the following command:

$ sudo gem install -n /usr/local/bin jekyll

This will install jekyll on the right location. If you do no get an error message, you are good to go! Unfortunately, I had another issue:

"ERROR:  Error installing jekyll:     liquid requires Ruby version >= 2.1.0."

In order to run Jekyll, you need ruby. Ruby is installed on macOS by default, but not in the latest version. The latest version of Jekyll requires Ruby version >= 2.1.0.

If you are in the same situation, I recommend you leave the ruby of macOS alone and install another version (more recent) aside. Two main options:

  1. Update using RVM
  2. Update using Brew.

 

Option 1: Update ruby with RVM

Ruby Version Manager (RVM) is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

Follow the instructions on how to install RVM on https://rvm.io/

Then install ruby in version 2.4.2 for example:

$ rvm install 2.4.2

 

Option 2: Update ruby with brew.

Using brew (https://brew.sh/), "Homebrew installs the stuff you need that Apple didn’t." For example, I am also using brew when I installed git, php, wget or docker. Install brew:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 Once you have brew installed, you will be able to install a more recent version of ruby:

$ brew install ruby

 

Install Jekyll

Your system should now be ready to install Jekyll. You cannot use brew to install Jekyll, so just run the following line:

$ sudo gem install -n /usr/local/bin jekyll

 

That's all. Have fun!

 

Join the conversation

Luc Bézier

Consultant Solution Architect