34

Possible Duplicate:
ruby 1.9 ri problem

When I try to use Ruby's ri tool in a command prompt window to get help about classes, methods, etc. it seems to always fail. For example if I type:

ri Array

I get a message saying:

Updating class cache with 0 classes... Nothing known about Array

I am using Vista 64 with Ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] installed.

What should I do to configure ri to work?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275

1 Answers1

76

Although this question is old, nobody has yet provided a proper solution. I just ran into the same issue, and found the solution:

If you are using RVM:

rvm docs generate-ri # <- Just the ri docs, much faster
rvm docs generate    # <- Everything (rdoc + ri)

More info on managing RVM docs here:
https://rvm.io/rubies/docs

If not using RVM:

gem install rdoc-data

# Regenerate system docs
rdoc-data --install

# Regenerate all gem docs (rdoc + ri)
gem rdoc --all --overwrite 

# Regenerate all gem docs (ri only)
gem rdoc --all --overwrite --ri --no-rdoc

# Regenerate specific gem doc with specific version
gem rdoc gemname -v 1.2.3 --overwrite
Casper
  • 33,403
  • 4
  • 84
  • 79
  • 1
    Ruby Documentation now says use `rvm docs generate-ri` for this – Nikesh Mar 04 '15 at 12:29
  • I think `--overwrite` option doesn't need because there's no existing document to overwrite. Another thing because the question was asking `ri` command to work, so we probably don't need `rdoc` so I suggest the command can be `gem rdoc --all --ri --no-rdoc` http://guides.rubygems.org/command-reference/#gem-rdoc – kangkyu Dec 11 '17 at 06:34
  • 4
    One more thing, `rdoc-data --install` command does not work on ruby 2.4 (it currently returns `Your ruby version 2.4 is not supported, only 1.8, 1.9, 2.0, 2.1, 2.2, 2.3`) so I'm still looking for another way to get `ri Array` command working. (for std-lib and core-ruby document) – kangkyu Dec 11 '17 at 06:42
  • in Debian (10.5) the solution for me was `apt-get install ri` . – Nicola Mingotti Oct 21 '20 at 17:49