Jekyll on macOS

Install Command Line Tools

To install the command line tools to compile native extensions, open a terminal and run:

xcode-select --install

set SDKROOT (only macOS Catalina or later)

Starting on macOS Catalina (10.15) the headers used for Ruby have been moved from their previous location which results in some gems, including Jekyll to fail installation. This can be solved by setting SDKROOT in your shell configuration to the value provided by xcrun.

export SDKROOT=$(xcrun --show-sdk-path)

Install Ruby

Jekyll requires Ruby v2.5.0 or higher. macOS Big Sur 11.x ships with Ruby 2.6.3. Check your Ruby version using ruby -v.

If you’re running a previous version of macOS, you’ll have to install a newer version of Ruby. Installation with Homebrew is simple if you’re only planning to use Ruby for Jekyll. Install with a version manager such as asdf, chruby, rbenv, or rvm if you need to switch among Ruby versions (instructions for rbenv are below). See the guide Install Ruby on Mac for details and recommendations.

With Homebrew

To run the latest Ruby version you need to install it through Homebrew.

# Install Homebrew
/bin/bash -c "$(curl -fsSL"

# Install Ruby
brew install ruby

Add the brew ruby and gems path to your shell configuration:

# If you're using Zsh
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.zshrc

# If you're using Bash
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.bash_profile

# Unsure which shell you are using? Type
echo $SHELL

Relaunch your terminal and check your Ruby setup:

which ruby
# /usr/local/opt/ruby/bin/ruby

ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

You’re now running the current stable version of Ruby!

With rbenv

People often use rbenv to manage multiple Ruby versions. This is very useful when you need to be able to run a given Ruby version on a project.

# Install Homebrew
/bin/bash -c "$(curl -fsSL"

# Install rbenv and ruby-build
brew install rbenv

# Set up rbenv integration with your shell
rbenv init

# Check your installation
curl -fsSL | bash

Restart your terminal to apply your changes. Next, you can install the Ruby version you want. Let’s install the latest stable version:

rbenv install 3.0.0
rbenv global 3.0.0
ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

That’s it! Head over to rbenv command references to learn how to use different versions of Ruby in your projects.

Install Jekyll

After installing Ruby, install Jekyll and Bundler.

Local Install

Install the bundler and jekyll gems:

gem install --user-install bundler jekyll

Get your Ruby version:

ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

Append your path file with the following, replacing the X.X with the first two digits of your Ruby version:

# If you're using Zsh
echo 'export PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"' >> ~/.zshrc

# If you're using Bash
echo 'export PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"' >> ~/.bash_profile

# Unsure which shell you are using? Type
echo $SHELL

Check that GEM PATHS: points to your home directory:

gem env

Every time you update Ruby to a version in which the first two digits change, update your path to match.

Global Install

We recommend not installing Ruby gems globally to avoid file permissions problems and using sudo.

On Mojave (10.14)

Because of SIP Protections in Mojave, run:

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

Before Mojave (<10.14)


sudo gem install bundler jekyll


See Troubleshooting or ask for help on our forum.