Installed gems aren't installed

Like the subject says, I've got a really weird problem.

A co-worker added a couple of gems to our rails project. I installed
these gems on my machine (a macbook, os x 10.5.6), start the server,
and it says it can't find these gems:

Martijn,

I have faced some of this. I found that doing
  sudo gem update --system
  sudo gem cleanup

Really helped. Sometimes I did them a couple times in a row.

The error about Rails 2.1.0 already running (or something like that)
might have to do with the environment.rb file you have, which might
specify a particular rails version. That also used to happen to me,
and I usually had several versions of Rails on one machine. I don't
believe that's ideal, so now there's just one and I edit
environment.rb for each project accordingly.

--Colin

I have faced some of this. I found that doing
sudo gem update --system
sudo gem cleanup

Thanks! I'll definitely try that.

In the end, I managed to fix it by simply installing everything in
~/.gem

Not the prettiest solution, but at least it seems to work for now.
I guess some gem overview file got corrupted or something then?

The error about Rails 2.1.0 already running (or something like that)
might have to do with the environment.rb file you have, which might
specify a particular rails version.

environment.rb specified Rails 2.2.2 (and 2.1.1 before that), but
despite that at some point ruby tried to load 2.1.0 modules.
Removing 2.1.0 meant it tried to load Rails 1.x, which I think
was installed in a completely different location even.

That also used to happen to me,
and I usually had several versions of Rails on one machine. I don't
believe that's ideal, so now there's just one and I edit
environment.rb for each project accordingly.

I prefer working in the same version of Rails as my co-workers, so
if one project is upgraded and another isn't, I need both versions
of Rails.

mcv.

This doesn't seem to do anything for me:

$ sudo gem update --system
Updating RubyGems
Nothing to update
$ sudo gem cleanup
Cleaning up installed gems...
Attempting to uninstall rails-1.2.6
ERROR: While executing gem ... (Gem::InstallError)
     Unknown gem rails = 1.2.6

So what does this mean? Is my gem installation even more
broken than usual? I do have rails-1.2.6 is another gem
repository:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems

instead of my usual

/Library/Ruby/Gems/1.8/gems

The latter is where all gems are that I installed myself. Both
the ones that worked and later the ones that didn't.

mcv.

What OS and version and version of ruby?

What OS and version and version of ruby?

OS X 10.5.6

ruby 1.8.6.114 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.1 at /Users/mcv/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

Martijn.

God. You said that, sorry. I'm running on 3 hours sleep. That IS very
strange. Hm.

Martijn:

I had similar odd symptoms a while back. It turned out that I had two
different versions of both Ruby and RubyGems installed and was trying
to mix and match between them without realizing it.

Older versions of Ruby and Gem want to live in /usr, but newer
versions seem to want to live in /usr/local.

I was confused until I figured out that my development environment
pointed to the newer versions, but my Rails app was pointing to the
older versions. Commands issued from the command line found a new gem
I'd installed, but of course the Rails app couldn't see it because I
hadn't installed it for both old and new versions.

If you have two (or more) versions installed on the same machine, make
certain that your environment variables and your configuration files
are set for the correct location for both Ruby and Rubygems. Be sure
to check both Rails environments: development and production. If
your development is done as one user and your Rails app runs as a
different user, be sure to check the settings for both user accounts.

Hope that helps.

Kind Regards,

Greg