Benjamin
Benjamin

Reputation: 99

Ruby on Rails: "Error installing rails: rdoc requires json"

Now this is my first question here. I'm trying to install Ruby On Rails for the first time on my Macbook, following this guide: http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/

I think, Ruby and RubyGems are set up correctly, but when I call the "sudo gem install rails"-command, the terminal sends back the following warnings and errors:

WARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and /usr/local/bin aren't both writable.

WARNING: You don't have /Users/benjaminkowalski/.gem/ruby/1.8/bin in your PATH, gem executables will not run.

ERROR: Error installing rails: rdoc requires json (~> 1.4, runtime)

Since I'm no expert with the terminal - what should I do next? Google and Stackoverflow don't tell..

Upvotes: 2

Views: 3111

Answers (3)

cacois
cacois

Reputation: 2076

That error comes from using an older version of Ruby to install the current version of Rails.

The tutorial you are using had you install Ruby 1.8.7. I don't know offhand if Ruby 1.8.7 will install Rails 3.1.1 (current as of this post). I'd recommend trying to install Ruby 1.9.2 and then using it to install Rails 3.1.1.

To make this Ruby version thing easier, I'd highly recommend trying RVM. Its dead simple and incredibly useful for maintaining and using multiple versions of Ruby concurrently.

Upvotes: 0

Fabio Ceconello
Fabio Ceconello

Reputation: 16039

I had the same problem installing RoR on Fedora core 10.

What I did to solve:

1) Install both ruby and gem from their source packages, not via yum:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
tar xvf ruby-1.8.7-p174.tar.gz
cd ruby-1.8.7-p174
./configure
make
make install
cd ..

wget -q http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xzf rubygems-1.3.6.tgz
cd rubygems-1.3.6
ruby setup.rb
cd ..

2) Install the json gem before installing rails

gem install json
gem install rails

Upvotes: 2

djd
djd

Reputation: 1001

You seem to be using a older version of ruby , try installing the latest binary of ruby and alternatively try installing RVM, this will help you to manage ruby versions and gems in a easy way.

Upvotes: 3

Related Questions