views:

1785

answers:

3

Hey all, I've recently installed RDoc version (2.4.3) through Ruby gems to replace the one shipped with Mac OS X (version 1.0.1). Unfortunately, I can still only use RDoc 1.0.1 when I call run "rdoc" at the command line. rdoc -v returns:

RDoc V1.0.1 - 20041108

I tried amending the $PATH variable to point the first entry to the RDoc 2.4.3 folder but no luck. I couldn't find anything about this online either, so I thought I'd ask here.

Cheers!

Update:

Running "gem list -d --version 1.0.1 rdoc" returns:

*** LOCAL GEMS ***

rdoc (2.4.3)
    Authors: Eric Hodel, Dave Thomas, Phil Hagelberg, Tony Strauss
    Rubyforge: http://rubyforge.org/projects/rdoc
    Homepage: http://rdoc.rubyforge.org
    Installed at: /usr/local/lib/ruby/gems/1.8

    RDoc is an application that produces documentation for one or more
    Ruby source files

Therefore, it's definitely the Mac OSX version of RDoc that's interfering with the Gems version.

Update 2:

I found out, using:

`bash --debugger rdoc`

that the old version of RDoc was in /opt/local/bin. I deleted it and added my gems directory to my $PATH

`export PATH=/usr/local/lib/ruby/gems/1.8/gems/`

I now have a fresh working copy of the latest RDoc!

+1  A: 

This problem tells you that your two versions are installed in different gem repositories.

Try this:

gem list -d --version 1.0.1 rdoc
gem list -d --version 2.4.3 rdoc

This will give you detailed information on where the gems are installed. If you can, uninstall the old version.

gem uninstall --install-dir /old/gem/repository --version 1.0.1 rdoc

If you installed the new version in a nonstandard place, you may need to add that repository's bin directory to your path, and add that directory to your GEM_PATH environment variable. So in your .login or .bash_profile or whatever:

PATH = $PATH:/new/gem/repository/bin
export PATH

GEM_PATH = $GEM_PATH:/new/gem/repository
export GEM_PATH

You can also set GEM_PATH in a ~/.gemrc file, but that's not always read by command-line tools.

Sarah Mei
Thanks Sarah,The issue is not with two versions of RDoc installed by Ruby Gems conflicting; the version of RDoc that came with Leopard on my Mac is conflicing with the RDoc installed from Ruby Gems.I ran gem list -d --version 1.0.1 rdoc. It returned:*** LOCAL GEMS ***rdoc (2.4.3) Authors: Eric Hodel, Dave Thomas, Phil Hagelberg, Tony Strauss Rubyforge: http://rubyforge.org/projects/rdoc Homepage: http://rdoc.rubyforge.org Installed at: /usr/local/lib/ruby/gems/1.8
jkale
Hmm. I'd still recommend removing the old version. If it's not a typcial gem install I'd say just delete it. Another thing to check, though it sounds like maybe you have, is that /usr/local/lib/ruby/gems/1.8/bin is in your path.
Sarah Mei
Thanks for your help Sarah; I managed to solve the problem!
jkale
A: 

I had similar issue on Windows running Instant-Rails. In the end, I just renamed my ruby/lib/ruby/1.8/rdoc directory to rdoc.bak and from then on my rake tasks ran correctly with the new gem rdoc.

Chinasaur
A: 

Just a thought...in Linux we would usually create a link (i.e. /opt/local/bin/rdoc) that points to the binary that's missing in the existing path. In your case we'd do something like this: ln -s /opt/local/bin/rdoc /usr/local/lib/ruby/gems/1.8/gems/rdoc

This way the $PATH variable stays a little less cluttered, and you have more control over which binaries you're using.

hope this helps!

btelles