Category Archives: ruby

[Ruby] Fixing: “Cannot load such file — hitimes/hitimes” when installing jekyll

I was getting the above error and the only page I could find was https://github.com/copiousfreetime/hitimes/issues/17 which doesn’t look related.

Context: I was trying to follow [1] and run jekyll on my local machine. When running bundle exec jekyll serve I got a stacktrace with the message:

Cannot load such file — hitimes/hitimes

I’m on a MacOS ans installed ruby using brew. The problem is that I had a native ruby installation and also remains from a previous mac port install. The fix was quite simple. First, how I got to a messed up stage:

I had a version of ruby running, but even when installed the newest version using brew, the versions were not matching:

ruby -v

Then I decided to override the PATH variable to find the brew installation first. For that we need to know where that is located:


$brew ls ruby
...
/usr/local/Cellar/ruby/2.1.5/bin/ruby

I also n00b’ed and hard-coded the /usr/local/Cellar/ruby/2.1.5/bin/ in the PATH env variable. But by default, brew will create a soft link to

/usr/local/opt/ruby

But my directories were messed up (maybe because I was using macports before) and so the link was not created. To fix that, I had to run:

brew link --overwrite ruby

After fixing the symlink, I updated my path to include /usr/local/opt and this fixed the issue.

References

[1] https://help.github.com/articles/using-jekyll-with-pages/
[2] http://stackoverflow.com/questions/6482738/installing-ruby-gems-not-working-with-home-brew