How to Use Jekyll on macOS Catalina with RVM

nickymarino

Nicky Marino

Posted on September 24, 2020

How to Use Jekyll on macOS Catalina with RVM

This post was originally published on my website. Check it out for more awesome content!

Apple bundles a system version of the Ruby programming language on macOS. Because system Ruby is used by the inner workings of the operating system, this version is not meant to be upgraded or modified by a user. With the Ruby Version Manager RVM, you can install an additional Ruby version for personal use.

Similar to pyenv, you can install multiple versions of Ruby with RVM and change the version you’re using on the fly. You can also install gems without sudo.

Installing RVM and Ruby

Before downloading RVM, first install gpg and the mpapis public key:

$ brew install gnupg
$ gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Enter fullscreen mode Exit fullscreen mode

The keys (xxxx...) change often, so you will need to copy the most recent ones from the RVM install page.

Next, download the most recent stable version of RVM:

$ \curl -sSL https://get.rvm.io | bash -s stable --ruby

Enter fullscreen mode Exit fullscreen mode

After installation, RVM will tell you to either open a new terminal or source rvm, so run the command it prints:

$ source ~/.rvm/scripts/rvm

Enter fullscreen mode Exit fullscreen mode

You will also want to add rvm to your ~/.zshrc or ~/.bashrc to load when you open a terminal:

# Add this to your ~/.zshrc or ~/.bashrc
[[-s "$HOME/.rvm/scripts/rvm"]] && . "$HOME/.rvm/scripts/rvm"

Enter fullscreen mode Exit fullscreen mode

Use rvm list to find a Ruby version you want to install, then tell RVM which version to use:

$ rvm list
$ rvm use 2.7.0

Enter fullscreen mode Exit fullscreen mode

You can then verify that you’re using an RVM-managed version of Ruby:

$ which ruby
~/.rvm/rubies/ruby-2.7.0/bin/ruby

Enter fullscreen mode Exit fullscreen mode

Installing Jekyll

First, verify you’re using a Ruby version managed by RVM in the above step. Then, install the Jekyll gem:

$ gem install jekyll bundler

Enter fullscreen mode Exit fullscreen mode

If you’re already in a Jekyll website repo (or any folder with a Rakefile), you can use bundle to install your remaining requirements:

$ bundle install

Enter fullscreen mode Exit fullscreen mode

You may then need to update Jekyll for your Rakefile requirements:

$ bundle update jekyll

Enter fullscreen mode Exit fullscreen mode

Now you can up the Jekyll server:

$ bundle exec jekyll serve

Enter fullscreen mode Exit fullscreen mode

Now check out your site at http://localhost:4000! See the Jekyll Quickstart for more details on starting a Jekyll blog.

💖 💪 🙅 🚩
nickymarino
Nicky Marino

Posted on September 24, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related