Install Jekyll on MacOS
Install Command Line Tools
First, you need to install the command-line tools to be able to compile native extensions, open a terminal and run:
$ xcode-select --install
Install Ruby
Jekyll requires Ruby > 2.5.0. macOS Catalina 10.15 comes with ruby 2.6.3, so you’re fine. If you’re running a previous macOS system, you’ll have to install a newer version of Ruby.
With Homebrew
To run the latest Ruby version you need to install it through [Homebrew][Homebrew].
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
$ brew install ruby
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/2.7.0/bin
You may want to add this to your PATH.
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/skyhawk/.bash_profile
For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
Then relaunch your terminal and check your updated Ruby setup:
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
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 Jekyll
Now all that is left is installing Bundler and Jekyll.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ gem install --user-install bundler jekyll
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
$ echo 'export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"' >> ~/.bash_profile
Create the First Website
$ jekyll new my-awesome-site
$ cd my-awesome-site/
$ bundle exec jekyll serve
Could not find gem 'minima (~> 2.5)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
$ gem install minima
$ gem install jekyll-feed
$ bundle exec jekyll serve
Configuration file: /Users/skyhawk/my-awesome-site/_config.yml
Source: /Users/skyhawk/my-awesome-site
Destination: /Users/skyhawk/my-awesome-site/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 0.232 seconds.
Auto-regeneration: enabled for '/Users/skyhawk/my-awesome-site'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
Check out the [Jekyll on macOS][Jekyll-on-macOS] for more info on how to install Jekyll on macOS.