rubymacosri

Ruby's ri command returns "Nothing known about Array"


edit: Question answered by @FrederickCheung . I needed to reinstall ruby this time passing an argument to include docs:

brew install ruby --with-doc

Question:

I'm new to ruby and trying to get the ri command to work in Terminal (iTerm2 on OSX Yosemite). Here's what I've tried so far (everything is pasted from the terminal):

ri Array
Nothing known about Array

So I google around and tried:

gem install rdoc-data

Fetching: rdoc-data-4.0.1.gem (100%)
rdoc-data is only required for C ruby 1.8.7 or 1.9.1.

rdoc-data is required for JRuby.

To install ri data for RDoc 4.0+ run:

rdoc-data --install

Successfully installed rdoc-data-4.0.1
Parsing documentation for rdoc-data-4.0.1
Installing ri documentation for rdoc-data-4.0.1
Done installing documentation for rdoc-data after 0 seconds
1 gem installed

Tried it again:

ri Array
Nothing known about Array

Then I tried:

rdoc-data --install
Your ruby version 2.2.0 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0

I googled around but the only results I get are for people using rvm or trying to disable the docs for rails installations. I installed ruby via homebrew if that means anything. I'm not really sure where to go from here, but I'd really like to be able to access the docs via ri.


Solution

  • Brew defaults to disabling installation of documentation.

    If you check the formula you can see that unless you pass --with-doc to brew install ruby, it will pass --disable-install-doc to the ruby configure script.