Cannot run Jekyll new command
It looks like you have multiple versions of Ruby on your system (1.8.7 and 2.1.1), which is very common, and part of the reason tools like rvm
and rbenv
were created. The issue is that when you did gem install jekyll
(maybe with a sudo
) and sudo gem install json
, these seem to have ended up in different spots and aren't finding each other. The /usr/local/bin
location is typically where Homebrew puts things (hence, you have ruby
listed under brew list
) and this is your Ruby 2.1.1 location. However, your jekyll
installation is under the location of the Apple-installed Ruby 1.8.7.
Step 1: try gem uninstall jekyll
, then gem install jekyll
. This should fix your problems.
Step 2: If that doesn't work, try to use rbenv or rvm to select a different version of Ruby, then try Step 1 again.
For example, my installations are here (managed via rvm
):
$ which jekyll/Users/nicksuch/.rvm/gems/ruby-2.0.0-p247/bin/jekyll$ which gem/Users/nicksuch/.rvm/rubies/ruby-2.0.0-p247/bin/gem$ which ruby/Users/nicksuch/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
In my case the Jekyll template suggested to use bundle
utility as:
bundle exec jekyll build
The solution was to include json
into Gemfile
(which was already part of the sources):
diff --git a/Gemfile b/Gemfileindex 98b29af..b8537cf 100644--- a/Gemfile+++ b/Gemfile@@ -1,7 +1,8 @@ source "https://rubygems.org"+gem "json" gem "jekyll", "~> 3.0" gem "jekyll-sitemap"
DETAILS
What lead me to the solution was the following fact:
- command
gem list json
showedjson
gem installed; - but command
bundle exec gem list json
didn't show anything.
I also tried to run bundle exec gem install json
- it didn't work. My best guess was that bundle
sets up the environment for a single run based on Gemfile
which is the only way to make set of dependencies persistent across each bundle exec ...
executions.