Jekyll defaults to system Ruby version instead of RVM version

jekyll, ruby, rvm

Solution

Your system ruby has jekyll installed, so it tells the stack trace

# from /usr/bin/jekyll:22

The reason it calls that binary before your updated jekyll is probably due to the order within your $PATH so to solve this; one option is to remove the old jekyll binary:

$ which jekyll #=> /usr/bin/jekyll
$ sudo rm `which jekyll`

That should suffice. Try again now.

In addition, given the gem was probably installed along with that binary try to remove the old gem version.

$ rvm use system
$ ruby -v #=> ruby 1.8.7

$ gem uninstall jekyll # add sudo if you get a permission error

Problem

I've looked through tens of posts regarding this and still can't quite figure it out/haven't found an identical situation. Basically, I have RVM with the default set to Ruby 2.0.0, but when I cd to the directory with my Jekyll page and run ``` jekyll serve ``` the result is ``` /Library/Ruby/Site/1.8/rubygems/dependency.rb:298:in `to_specs': Could not find 'jekyll' (>= 0) among 5 total gem(s) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems/dependency.rb:309:in `to_spec' from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_gem.rb:47:in `gem' from /usr/bin/jekyll:22 ``` even though in the same directory when I run ``` ruby -v ``` the result is ``` ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0] ``` If I run ``` rvm use 2.0.0@project-directory ``` and then run ``` jekyll serve ``` it works like a charm. I've tried using .rvmrc and .ruby-version files in the root, and in both cases when I cd to the directory nothing indicates that those are recognized.

Original source