Whenever installing open source based software, I frequently lose confidence whether I’m on the right track in the course of doing it. It’s mainly because I’m not sure if the instructions on the net is suitable for my setting, if I fully understand them, and if I follow them correctly. If I miss something, things go wrong and I have trouble in reverting back, easily get lost. Therefore it’s natural and safe to have my first post on Jekyll platform to be about how to install it.
Jekyll is based on ruby and the installation process heavily uses ruby companion tools. macOS is coming with factory installed ruby, which I was not aware of until now, but it’s not suitable version to install Jekyll. So, we need to start from there.
Ruby Version on macOS 10.12.6 Sierra
In my setting, I have ruby 2.0.0p648 and gem 2.0.14.1 as follows.
Also, I have following ruby based components already installed. You don’t need this info to install Jekyll, it’s just for my record.
Install Jekyll, First Trial
When I tried to install Jekyll in the setting above I got following error.
Since it says I have no permission for /Library/Ruby/Gems/2.0.0, I tried sudo.
Now, I realized I needed ruby version equal to or higher than 2.1.
Upgrade Ruby
According to internet, there are many ways to install ruby on macOS with some of them obsolete. I chose to use rbenv to install ruby and, in turn, I need Homebrew to install rbenv. Just check current brew version for the record.
Install rbenv using brew. Great… I have another error, about Xcode this time.
Try to install xcode-select. Looks good.
Try again to install rbenv.
This time I come across Error: The 'brew link' step did not complete successfully
As the error message suggested, I ran brew link autoconf.
Oh, I don’t have write permission on /usr/local/share/info. I changed the permission and tried again to success.
Now I am ready to install ruby. (Not Jekyll!)
Using following command, I can see numbers of available ruby versions.
As of today, the latest stable version looks 2.5.0. Get it.
Make macOS Aware of Ruby 2.5
Now I have two versions of ruby, the factory installed 2.0 and the upgraded 2.5.
When I run ruby -v in the terminal, I can see 2.0 running.
To make 2.5 to run, I need to dig in rbenv configuration.
As shown below, I have hidden folder .rbenv under my home folder. Note that there is no version file in it yet while I got versions folder.
Run rbenv global 2.5.0 and check .rbenv/ to find version file, which tells ruby version number I want to use.
There are three way to let macOS aware of ruby version, global, local, shell. For more info, read this.
Unfortunately we am not there yet. In .rbenv/shims, we have a collection of scripts to run ruby.
This folder should be in PATH environment variable so that macOS know where to search for ruby 2.5.
Add following line in your bash config file, which is ~/.bash_profile in my case, and restart the terminal.
Run ruby, then you will see it’s running version 2.5.
Install Jekyll, Second Trial
At last, we are ready to install Jekyll.
Oh, we need to install bundler too.
Make Your Blog Folder
Run following commands and open http://localhost:4000 from your browser, then you can see Jekyll blog is running.
However, you still have it loaded to GitHub and probably want to change its theme. So, let’s continue.
Make GitHub Repository
If you are sure you don’t need to change Jekyll’s default theme, you just have to make GitHub repository, and run following commands in my-awesome-site folder. Otherwise, just go to next section.
Change the Theme to Centrarium
If you want to change the theme as I do, it may be easier to do as follows. I will use Centrarium theme.
Forget my-awesome-site folder.
Make another folder, which is ryuci.github.io in my case.