Rubygems problem on Mac OS X, please help

I finally got around to installing the latest Ruby version onto my Mac
instead of using the one that comes with Mac OS X. I followed the
instructions here:

http://maczealots.com/tutorials/rubyosa/

Doing so, I installed readline 5.2, then built and installed Ruby
1.8.6, then installed rubygems 0.9.3. (Notice that in the link above
it says to install readline 5.1 and rubygems 0.9.2, but I just
downloaded the latest versions at the time.

Everything seems to work fine, except rubygems. Whenever I issue a
command, I get an error about an uninitialized constant. E.g.:

gem list -r

*** REMOTE GEMS ***
ERROR: While executing gem … (NameError)
uninitialized constant Gem::SourceInfoCache

gem install rubyosa
ERROR: While executing gem … (NameError)
uninitialized constant Gem::RemoteInstaller

Can somebody help me?

Before you ask, yes I installed everything into /usr/local, and yes I
made sure /usr/local/bin is first in my path. Doing “which ruby” and
“ruby -v” both confirm that I am running ruby 1.8.6 from /usr/local/
bin. Are there any other environment variables I need to set to enable
rubygems?

On May 28, 12:24 pm, Jim W. [email protected] wrote:

Gem::RemoteInstaller # makes sure the class was loaded
$:.find { |d| File.exist? File.join(d,
‘rubygems/remote_installer.rb’) }
# Finds the location of the
require file

The last command should show the location of the file containing the
RemoteInstaller class. Open the file and make sure it contains a proper
definition for RemoteInstaller.

Thank you! That was the problem: for some reason, the file
remote_installer.rb was present, but empty (zero bytes in size). But
there was also a file called remote_installer.1.rb that had the
correct contents. Likewise, source_info_cache.rb was empty, and its
contents were in source_info_cache.1.rb. I have no idea why this
happened, and all the other files seem fine. Fixing this solved the
problem.

Thanks again!

Karl von Laudermann wrote:

Everything seems to work fine, except rubygems. Whenever I issue a
command, I get an error about an uninitialized constant. E.g.:

gem list -r

*** REMOTE GEMS ***
ERROR: While executing gem … (NameError)
uninitialized constant Gem::SourceInfoCache

gem install rubyosa
ERROR: While executing gem … (NameError)
uninitialized constant Gem::RemoteInstaller

Can somebody help me?

Odd, RubyGems isn’t finding some of its own libraries. If the files
were missing, I would have expected an error on the require. Instead it
looks as if the files are found, but the contents are not there.
Interesting.

Try the following commands in irb:

require ‘rubygems/remote_installer’ # makes sure the file can be
found
Gem::RemoteInstaller # makes sure the class was loaded
$:.find { |d| File.exist? File.join(d,
‘rubygems/remote_installer.rb’) }
# Finds the location of the
require file

The last command should show the location of the file containing the
RemoteInstaller class. Open the file and make sure it contains a proper
definition for RemoteInstaller.


– Jim W.