4

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.

user1376243
  • 307
  • 2
  • 7
  • Probably a duplicate question. Try this: http://stackoverflow.com/a/6628309 – alexis Dec 26 '14 at 18:45
  • "I google 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." - from original post – user1376243 Dec 26 '14 at 18:47
  • 2
    Did you try installing it with the --with-doc option? – Frederick Cheung Dec 26 '14 at 18:52
  • @FrederickCheung I get the same result: `rdoc-data --install --with-doc option`       `Your ruby version 2.2.0 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0` – user1376243 Dec 26 '14 at 18:55
  • 2
    No I meant `brew install ruby --with-doc` – Frederick Cheung Dec 26 '14 at 19:00
  • @FrederickCheung awesome. that worked perfectly. i had no idea ruby was installed w/o docs by default. thanks for the response! is there any way to give you credit for the answer? – user1376243 Dec 26 '14 at 19:14

1 Answers1

5

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.

Frederick Cheung
  • 83,189
  • 8
  • 152
  • 174