When I initially tried to get Jekyll setup I ran into some issues with Ruby on MacOS, entirely unsurprisingly. While trying to resolve these issues I came across many resources on the internet that all provided partial solutions, but I don’t recall any one of them providing the entire solution I used. Unfortunately I did not document the resources I used to compile this, however my thanks go out to the many blogs, Stackoverflow posts and other various pages that led me in the right direction.
Previously I have tended to prefer to not use Homebrew to install packages as I have seen it create quite the mess on a machine that eventually had to be reimaged to get it back to a stable state. This installation will not use Brew, but installation via Brew is entirely possible and will likely save you a few commands.
A word of warning
But first, a word of warning, be cautious when copy and pasting commands from, well anywhere, but particularly the internet, as is demonstrated on Jann’s site on computer security [thejh.net]
Installation
Install rbenv
If Homebrew is installed, Brew will be used to install rbenv, however if Homebrew is not installed the script will checkout the git repository and compile from source.
Add the rbenv’s bin to the path, and make sure that it’s setup in the terminal.
or for Debian
Start a new terminal session to activate so these changes are incorporated in the environment. Make sure the installation did what it was supposed to, this should report no issues.
Verify this now points to something along the lines of ~/.rbenv/shims/ruby
Install a new version of Ruby
Grab a cup of coffee, this usually takes a few minutes.
Set rbenv to default to using the newly installed version and not the system version. This can be overridden on a per project basis by executing the command with local
in the projects root directory:
Confirm the active version is now set to 2.6.0
Bundler, Gems and Jekyll
Install the Bundler gem.
Create a new environment which will generate a new Gemfile
which will need to be edited:
Install the Gems from the Gemfile with Bundler.
All commands now need to be prefixed with bundler exec
when operating within the Bundler environment, ie:
Concluding notes
rbenv, a new version of Ruby, Bundler and using Bundler, Jekyll are all installed and hopefully functional.