Tim
Tim

Reputation: 541

gem installation broken?

I'm facing a problem I have never had before. The other day when I was going into a ruby project of mine that is in Sinatra and went to do a bundle install I got this error:

/Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)

Odd I thought and went ahead typing

gem list

and there I saw:

bundler (1.0.21, 1.0.2)

So there bundler is. Then after trying uninstalling bundler and reinstalling, switching ruby -v with rvm I tried running any other gem I have, like rails. So I ran rails s and bam, I got the same error as with bundler:

 /Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in`report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

What is going on? I then tried the same thing with all my gems and all gives the same error. Has this anything to do with rvm? I can't seem to remeber doing anything out of the ordinary these last couple of days that can have caused this. The only thing I have done is switching to ZShell with Oh My ZSH, but that can't have anything to do with this. What can be the problem? Should uninstall rvm altogether and reinstall it and then add the ruby -v I have again? My environment is Mac OS X Lion. Thanks in advance.

EDIT:

I now got it to roll. My switch to oh my zsh was indeed what was causing the problem. Amongst the places where I found the answer was here: https://stackoverflow.com/a/4755696/434299

Basically what you need to do is in your

~/.zshrc

Add this line:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 

Which loads rvm into a shell session. Problem solved! Thanks to Felix Rabe for pointing me in the right direction.

Upvotes: 4

Views: 1980

Answers (2)

Mario Zigliotto
Mario Zigliotto

Reputation: 9025

I fixed this differently.

My ~/.zshrc now has this line for the plugins and it solved the issues i was having:

plugins=(git bundler brew git osx ruby zsh-syntax-highlighting)

This is similar to the config that Ryan Bates uses here: http://railscasts.com/episodes/308-oh-my-zsh

Upvotes: 0

Felix Rabe
Felix Rabe

Reputation: 4286

Your use of "Oh my ZSH" together with RVM could be the cause. I googled for zsh rvm and found http://beginrescueend.com/integration/zsh, where it says at the bottom:

If you want to use oh my zsh be sure not to use the bundler package. If rvm should take care of everything this would do for you anyways.

(Copied from my comment above to get an "accept-able" answer.)

Upvotes: 3

Related Questions