0

My CLI is rusty so be kind...

On OS X Lion I installed RVM and then sudo gem install rails.

When I run plain old rails -v I get:

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

and if I run /usr/local/bin/rails I get all sorts of chaos starting with:

WARNING: #NameError: uninitialized constant Gem::VERSION>

# -- encoding: utf-8 --

Gem::Specification.new do |s| s.name = "bundler" s.version = "1.0.21"

...but if run sudo /usr/local/bin/rails -v I get:

Rails 2.2.2

...and sudo rails -v`:

/Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in 'to_specs': Could not find rails (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError) from /Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in 'to_spec' from /Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in 'gem' from /Users/dan/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in '<main>'

I am pretty sure I have multiple versions all on top of each other. Any tips to clear this all out and start from scratch?

0

1 Answer 1

3

I think you messed up your system.

If you're using user-level RVM (that's what is recommended), you don't need to sudo when installing gems, because they are installed to a folder in your HOME.

So, here's what I would do in your case:

  1. Clean up. Remove all rubies, gems and RVMs that you can find.

  2. Make sure you cleaned things up.

  3. Install RVM and follow instructions to the letter.

  4. Make sure RVM is activated.

  5. rvm install 1.9.3 (or another ruby of your choice)

  6. rvm use --default 1.9.3 (set default ruby)

  7. gem install rails (no sudo, remember?)

  8. PROFIT!

6
  • as in: rvm implode and delete these (via locate): /usr/local/lib/ruby/gems /usr/local/lib/ruby/site_ruby/1.8/rubygems /usr/share/devicemgr/backend/vendor/gems /usr/share/devicemgr/webserver/gemssudo
    – Dan Tappin
    Jan 7, 2012 at 4:02
  • This. If you've got rvm, use it! You'll have to make sure you have the proper config stuff in your .bash_profile (as listed on the RVM website, and then launch a new shell. Then, rvm install 1.9.3 as above. (Step 8 is also just as important.) Jan 7, 2012 at 4:04
  • @user1135515: rvm implode won't remove system ruby and system gems, AFAIK. But you know how to locate and delete things :-) Jan 7, 2012 at 4:07
  • what about these /usr/share/devicemgr/backend/vendor/gems & /usr/share/devicemgr/webserver/gems directories?
    – Dan Tappin
    Jan 7, 2012 at 4:09
  • They look pretty innocent to me, you can leave them. :-) Jan 7, 2012 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.