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
Error when running jekyll new command
I had the same problem and as commented above I installed the json gem with
sudo gem install json
to fix the problem.
My platform is Ubuntu Precise
Jekyll - command not found
The easiest method of doing this is to use RVM. It manages Ruby and all its gems for you and it's easy to use. See this link for using it.
If you did not want to use that you will need to modify your PATH variables so it can find your gems. I have found this to be tedious and reverted to RVM, but here are the general steps.
You will need to find out where your gems are getting installed. If you did gem install ...
the gems will be in ~/.gem/ruby/1.8/gems/bin
, if you used sudo gem install ...
the gems will be somewhere in /System/Library/Frameworks/Ruby.framework/Versions/1.8/Resources
You have to add this path to your PATH variable. Easiest way to do this is by running :echo 'PATH=$PATH:above/path/to/gems' >> ~/.bash_profile
Why is my jekyll command not working anymore?
I found a solution, that I think is very not clean, but works for now.
I have two directories in /Library/Ruby/Gems/
:
2.0.0/
gems/
specifications/
...
2.3.0/
gems/
specifications/
...
The error output, when I try to run jekyll, tells that it checks (among others) in /Library/Ruby/Gems/2.3.0
, but as I said in my question, there aren't any jekyll-related file in there.
So, I manually copied all the files from /Library/Ruby/Gems/2.0.0/gems
and /Library/Ruby/Gems/2.0.0/specifications
and pasted them in /Library/Ruby/Gems/2.3.0/gems
and /Library/Ruby/Gems/2.3.0/specifications
respectively.
I guess that the files I've copied are maybe outdated for the Ruby version I have (?), but it works perfectly.
Maybe there is a more conventional way to make it work?
Running Jekyll on Mavericks with latest command line tools error
You said that you are trying to use ruby 2.1.1. but your log show us ruby 1.8.7.
With that in mind, it seems that you have 2 rubies installed on your machine... ruby 1.8.7 installed by homebrew, and ruby 2.1.1 installed by rvm.
And apparently you also have jekyll installed on ruby 1.8.7 gemset...
So, I recommend you to do that:
gem uninstall jekyll
rvm use 2.1.1
gem install jekyll
Related Topics
Ruby Pipes: How to Tie the Output of Two Subprocesses Together
Load Two Ruby Modules/Gems with the Same Name
Getting a List of Classes That Include a Module
Is It Ever Necessary to Use 'Chomp' Before Using 'To_I' or 'To_F'
Why Don't Numbers Support .Dup
Ruby/Pgsql Error on Rails Start:Cannot Load Such File -- Pg_Ext (Loaderror)
Cannot Load Such File -- MySQL2/2.4/Mysql2 (Loaderror) - Windows
"Encoding::Invalidbytesequenceerror" Error Occurs in Rails 3.1.0
Check to See If an Array Is Already Sorted
How to Transpose Different Sized Ruby Arrays
How to Format a Date to Mm/Dd/Yyyy in Ruby