Gems was working but not anymore

I installed Ruby, Gems, Rails etc. following the instructions on

(Me: using Intel, 10.4, all other settings and versions same as that
website)

Gems was working as I was able to install Rails, Mongrel, Capistrano
and MySql bindings, and I was able to make a test app, and start it
using script/server
This was sometime last week

Now, I wanted to do some tutorials today, but I wasn’t able to invoke
script/server I got error:

/usr/local/bin/gem:9:in `require’: No such file to load – rubygems
(LoadError)
from /usr/local/bin/gem:9

I found out that I got the same error with anything that requires
gems. i.e. gem install rails. I even reinstalled Gems but that didn’t
help.

Any ideas on how I could get this working again? Thanks

Figured it out. When I did:

ruby -v

it gave me 1.8.2, meaning that it had reverted to the version included
with OSX for some reason.

I did this:

. ~/.bash_login

and it’s working again!

What have you installed since the last time gems worked?

In Terminal, type:
which gem
This should tell you the path to gem

Perhaps you have tried to do something which has a dependency that is
missing.
Many gems depend on other gems.
it’s good to use the --include dependencies option when you install
a gem.
Also look into freezing your gems, but that’s a different matter.

Did you start/stop the server? (make sure it’s not already running!)
Is Apache interfering? You may have to stop Apache to run another
server.

check the GEM_PATH also…
in .gemrc

make sure you’re in the directory of your Rails app when you invoke
script/server
notice that is the local path from the rails app’s directory.
To start that server from elsewhere:
( If you’re in another directory )
replace:
script/server

with:
~/rails_app_name_here/script/server

(this assumes you have the app in the top level of your user account,
in other words in your home directory which has your User Name)

Configuring paths can be a pain.
…and hard to remember and keep track of.
Rails relies on a little bit of Unix command line ability. The Unix
in A Nutshell book is highly recommended as a reference to have around!