To install the command line tools to compile native extensions, open a terminal and run:
xcode-select --install
Jekyll requires Ruby v2.5.0 or higher. macOS Catalina 10.15 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.
To run the latest Ruby version you need to install it through Homebrew.
# Install Homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install ruby
Add the brew ruby path to your shell configuration:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
Relaunch your terminal and check your Ruby setup:
which ruby # /usr/local/opt/ruby/bin/ruby ruby -v ruby 2.7.2p137 (2020-10-01 revision 5445e04352)
You’re now running the current stable version of Ruby!
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 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Install rbenv and ruby-build brew install rbenv # Set up rbenv integration with your shell rbenv init # Check your installation curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | 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 2.7.2 rbenv global 2.7.2 ruby -v ruby 2.7.2p137 (2020-10-01 revision 5445e04352)
That’s it! Head over to rbenv command references to learn how to use different versions of Ruby in your projects.
After installing Ruby, install Jekyll and Bundler.
Install the bundler and jekyll gems:
gem install --user-install bundler jekyll
Get your Ruby version:
ruby -v ruby 2.7.2p137 (2020-10-01 revision 5445e04352)
Append your path file with the following, replacing the X.X
with the first two digits of your Ruby version:
echo 'export PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"' >> ~/.bash_profile
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.
We recommend not installing Ruby gems globally to avoid file permissions problems and using sudo
.
Because of SIP Protections in Mojave, run:
sudo gem install bundler sudo gem install -n /usr/local/bin/ jekyll
Run:
sudo gem install bundler jekyll
See Troubleshooting or ask for help on our forum.
© 2020 Jekyll Core Team and contributors
Licensed under the MIT license.
https://jekyllrb.com/docs/installation/macos/