Ruby gem version issues

gem1.8 with Ruby 1.92

Page 1 of 1

8 Replies - 5049 Views - Last Post: 19 December 2011 - 11:29 AM Rate Topic: -----

#1 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Ruby gem version issues

Posted 01 June 2011 - 09:24 AM

Hey, so after I installed gem, I was having a lot of difficulty using gem. It was saying that gem wasn't a recognized command. After some snooping, I found that I had a file called gem1.8 on my hard drive, so I just typed that instead of plain old 'gem' when I went through tutorials. But now I'm installing rvm and a new version of ruby, and I'm seeing errors:

[error]
ruby-1.9.2-p180 - #importing default gemsets (/usr/local/rvm/gemsets/)
'gem' command not found, cannot select a gemset.
[/error]

This is mildly concerning. Is it normal to have gem1.8 instead of gem? How can I fix this?

Edit:

Ok I'm dumb, for now I just made an alias
alias gem='gem1.8'



It's still kind of disquieting that there might be something abnormal about my gem install. =/

This post has been edited by NotarySojac: 01 June 2011 - 09:28 AM


Is This A Good Question/Topic? 1
  • +

Replies To: Ruby gem version issues

#2 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby gem version issues

Posted 01 June 2011 - 10:19 AM

Ok, i've been sending a lot of commands to my debian box this last hour.
I:
-installed rvm
-installed ruby 1.9.2 (in two different ways I think)
-uninstalled ruby 1.9.2 (just one of them)
-made an aliase for gem='gem1.8'
-I think I did $ gem update --system
-Possibly other stuff I can't remember...


Anyway, my result is that I think I'm missing a lot of things from my gem file.

root@dhcppc2:/home/kentos/dev/rails# rails new mt -d mysql
/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rake-0.8.7, rake-0.8.7] (Gem::LoadError)
        from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
        from /usr/local/lib/site_ruby/1.8/rubygems.rb:1182:in `gem'
        from /usr/bin/rails:18
root@dhcppc2:/home/kentos/dev/rails# gem list

*** LOCAL GEMS ***

rake (0.8.7 ruby)



How should I proceed?

This post has been edited by NotarySojac: 01 June 2011 - 10:20 AM

Was This Post Helpful? 0
  • +
  • -

#3 xclite  Icon User is offline

  • LIKE A BOSS
  • member icon


Reputation: 916
  • View blog
  • Posts: 3,209
  • Joined: 12-May 09

Re: Ruby gem version issues

Posted 01 June 2011 - 11:42 AM

Please don't make multiple topics for the same issue - merged =p

I'd keep my gem version equal to my Ruby version - i.e. gem1.9 for Ruby 1.9.
Was This Post Helpful? 0
  • +
  • -

#4 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby gem version issues

Posted 01 June 2011 - 12:01 PM

Lol, thank you for the help. I hadn't realized that (what now seems to be an obvious) relationship between gem version and ruby version.

Do you know how to update gem to 1.9? I'm have difficulty finding it.
gemforge seems to only go up to 1.8.5

Edit: Ok, I don't 'get it' but I did $ gem install rails and that reistalled rails and all those gems I was used to looking at after I hit $ gem list. I read somewhere that ruby 1.9 includes gem somehow, and I don't get how that is cause I'm typing gem1.8 to interface with gem, but w/e, things are changing rapidly with rails and I'll just be happy if I can get my foot in the door with some sample apps.

This post has been edited by NotarySojac: 01 June 2011 - 05:05 PM

Was This Post Helpful? 0
  • +
  • -

#5 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby gem version issues

Posted 01 June 2011 - 12:32 PM

When I do

$  rails new mt
$  cd mt
$  rails s



And check localhost:3000, and then click that "About your applications environment" it says:

Ruby version:   1.8.7 (i486-linux)
RubyGems version:   1.8.5
...



But those aren't the versions I have setup with rvm:
root@dhcppc2:/home/kentos/dev/rails/mt# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]



What do I do to use ruby 1.9.2 with my rails application?

This post has been edited by NotarySojac: 01 June 2011 - 12:33 PM

Was This Post Helpful? 0
  • +
  • -

#6 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby gem version issues

Posted 03 June 2011 - 12:23 PM

OK, I'm in too deep. What is the definitive way of removing gem and rvm if they were downloaded and compiled from source?
Was This Post Helpful? 0
  • +
  • -

#7 powerbase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-December 11

Re: Ruby gem version issues

Posted 19 December 2011 - 02:15 AM

I was having fits googling:

gem: command not found

got nothing but a wild goose chase until you said you used gem1.8 so I renamed my file gem1.8 to gem and voila the gem command worked! I don't have rvm but I had fits until you solved the problem. I hope it solves your problem! Thanks!
Was This Post Helpful? 0
  • +
  • -

#8 Karel-Lodewijk  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 452
  • View blog
  • Posts: 857
  • Joined: 17-March 11

Re: Ruby gem version issues

Posted 19 December 2011 - 09:57 AM

Your problems all probably originate from the fact that you are mixing ruby/gem from rvm and ruby/gem from your package manager.

For example, my package manager has the packages

ruby/ruby1.8/ruby1.9.1

Ruby and ruby 1.8 are aliases (the same). If I install all 2/3 packages, in the /usr/bin directory I get a

gem/gem1.9.1

The first gem installs gems for version ruby/ruby1.8 the second gem installs gems for ruby1.9.1


If that weren't complicated enough you also have rvm (ruby version manager), a sort of ruby specific package manager, which is able to install any version of ruby. It typically installs it's own ruby/gem and associated gems in the ~/.rvm (~ stand for user directory) directory, which on a typical rvm installation take preference over the system's ruby/gem commands and associated gems. (if you followed the single user install guide that is).

So my advice, first clean up any custom aliases you've created

If you are fine with ruby versions packages provided by your system. Uninstall rvm. If it was a singled use install, remove ~/.rvm and remove the lines from ~/.bash_profile that refer to .rvm.

If you want to use any other version of ruby. Either track down a package that will work for your system. Or reinstall rvm (uninstall rvm like before) and follow http://beginrescueen...m/rvm/install/. Remember it's a 3 step process.

  • Install rvm
  • Use rvm to install a version of ruby for example: "rvm install 1.9.3"
  • Pick a default "rvm use 1.9.3 --default"


It's all in that page but are easy to miss.

After that the plain ruby command should be the version you specified (verify with ruby --version) and the plain gem command should install gems for that version of ruby.

This post has been edited by Karel-Lodewijk: 19 December 2011 - 10:14 AM

Was This Post Helpful? 1
  • +
  • -

#9 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby gem version issues

Posted 19 December 2011 - 11:29 AM

This post got necroed a tiny bit, but both amnesty to new users (Welcome to the forums powerbase!) and also, if this thread is getting picked up by google, it should probably contain some more concrete information like what Karel-Lodewijk put down.

I put together a Debian Linux step-by-step procedure for installing rvm, rails/ gem, and tweaking webrick for performance boosts that I wish I had before I started messing around with installing apt-get packages.

That procedure is here for anyone having trouble figuring out gem and ruby using a Debian style OS.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1