views:

409

answers:

4

I have an issue when trying to set up rvm, where gems weren't installing due to them being dependent on json_pure. I tried to install json_pure, but rubygems itself seems to depend on json_pure. I have tried removing all versions of json_pure, but rubygems still complains.

$ sudo gem install json_pure
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)

I have tried downloading the gem and installing it locally, but rubygems still complains about the dependency.

A: 

I can't understand if you are having an issue installing RVM or using RVM. If you need to install RVM, don't use sudo.

Just type

$ gem install rvm

RubyGems will install it in your home directory. Then, proceed with rvm-install and follow the instructions.

When using RVM, never use sudo.

Simone Carletti
The issue isn't with rvm, it's with importing my gems after rvm is installed. When installing json_pure with using rubygems, rubygems quits as it relies on json_pure, which I am trying to install in the first place (with or without sudo)gem install json_pure/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)
andrewmcdonough
Thanks for the advice. I will keep in mind that I shouldn't sudo with .rvm. Makes sense since it lives in my home directory.
andrewmcdonough
+1  A: 

I fixed this issue by copying the json and json_pure gems and their specs from a working ruby directory into the .rvm gem directory of the broken ruby. Not sure why rubygems itself ever relies on another gem.

cp -r ~/.rvm/gems/ruby-1.8.7-p249/gems/json* ~/.rvm/gems/ruby-1.8.6-p399/gems/
cp -r ~/.rvm/gems/ruby-1.8.7-p249/specifications/json* ~/.rvm/gems/ruby-1.8.6-p399/specifications/
andrewmcdonough
A: 

This issue came about when I removed all the json-pure versions in my main $PATH. To resolve the issue I reloaded RubyGems 1.3.7 from source and was able to reinstall the json-pure gem. Note: I was not using RVM.

Steps:

1) Download RubyGem 1.3.7.tgz

2) Use these commands at the command prompt

tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo /opt/local/bin/ruby setup.rb

3) Try a gem command

gem list

4) If it works, install the json-pure gem // might need to install the json gem also.

sudo gem install json
sudo gem install json-pure
bweikulrich
A: 

I had this exact problem, and the above solutions didn't work for me. (I don't use rvm, and re-installing RubyGems didn't resolve the issue.)

This is what I did to fix my setup on my Mac. (Ruby 1.8.6, Mac OS X 10.5.8)

1) Go to http://rubygems.org/gems/json_pure

2) Download the json_pure gem to ~/Downloads

3) cd ~/Downloads/

4) sudo gem install json_pure-1.4.6.gem

(You'll still see the "Could not find RubyGem json_pure" error, but the install does work. To double-check you can redo 'sudo gem install json_pure-1.4.6.gem' and you shouldn't see the error the second time.)

5) Verify that json_pure is now installed:

gem list
hugs