I recently had a problem trying to install Rails 3 on my MacBook with a fresh OSX Snow Leopard:
sudo gem install rails
Password: {entered}
Successfully installed rails-3.0.7
1 gem installed
Installing ri documentation for rails-3.0.7...
File not found: lib
Turns out this is a somewhat common problem. But it seems that the solution is easy, just manually reinstall RDoc. To do this run these 3 commands:
sudo gem install rdoc-data
sudo rdoc-data --install
sudo gem rdoc --all --overwrite
The last line in particular will re-generate all the documentation for your installed gems (including Rails) and can take a while, but you should be able to confirm the fix by reissuing the Rails gem install command:
sudo gem install rails
shows that rails now installs properly and says that it has installed both ri and RDoc documentation without issue.