Static Sites with Jekyll

Static sites are fast to load and are particularly suited to blog style pages written with markdown. They also don’t require a database, so provide many benefits compared with Wordpress or Drupal. I considered Hugo, but decided to try Jekyll because of the effectively free hosting and native integration on GitHub. Also, there are more Themes readily available.

A note of caution…,sites using Jekyll are written locally on your computer and then pushed to the host. Therefore, Jekyll and all it’s pre-requisite software, for example Ruby, needs to be installed using the command line (terminal), which is not so user friendly and can result is some teething problems..

Some Problems Installing Jekyll Locally on a Mac

After cloning the So Simple Theme, by Michael Rose, I tried to install Jekyll locally as described on Jekyll

gem install Jekyll

However, I received the following error

"You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory"

This error has been described on the Jekyll forums gem-install-jekyll-failed-on-Mac-OS-X.

The steps taken to resolve these were as follows:

Install HomeBrew using

/usr/bin/ruby -e "$(curl -fsSL"

Install a user specific version of Ruby using

brew install ruby

Create a user specific bash profile as described at How To Edit Your PATH Environment Variables On Mac OS X using

nano .bash_profile  

Inside the .bash_profile add the line so it can find the updated path to the ruby as described How to add /usr/local/bin in $PATH on Mac

export PATH=$PATH:/usr/local/git/bin:/usr/local/bin

To ensure that all the Jekyll dependencies were installed I installed Bundler using

gem install bundler

and then within the directory having the Jekyll/ Github repository I ran

bundle install

Finally, as I was using Bundler to manager my dependencies, in order to run Jekyll locally, I needed to use

bundle exec jekyll serve

Now my site was successfully being served locally at using the built in web server provided by Jekyll.

It is worth noting that there is a great resource at GitHub Using Jekyll with Pages, which may be a simpler way to install Jekyll. I may try that next time…