21

I tried to install the new beta on my system with the command:

sudo gem install rails --pre

but no matter what I tried, I still get this damn error:

Successfully installed rails-3.0.0.beta3
1 gem installed
Installing ri documentation for rails-3.0.0.beta3...
File not found: lib

Since I'm very new to ruby, I really don't know what to do.

How can I finish installing this? Is this installed already? Why does it abort here?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Yolcu
  • 211
  • 1
  • 2
  • 3
  • you should close this question even if you have to answer it yourself. its been open for over 6 months now. – djangofan Dec 13 '10 at 05:35

6 Answers6

37

All you need to run is gem install rdoc, follow its instructions, then run the install rails command again and you're good. The problem is due to rdoc failing to install when installed with rails, if installed manually it works fine.

Source: http://gist.github.com/565967

^ I had the same problem, and this worked for me.

mikej
  • 65,295
  • 17
  • 152
  • 131
balupton
  • 47,113
  • 32
  • 131
  • 182
  • 1
    Would you edit this answer to add the actual content of that gist (namely, that `gem install rdoc` is what you need)? – Drew Stephens Oct 29 '10 at 22:09
2

If you're looking to do ruby/rails development on Mac, I'd strongly recommend not using the version of ruby/rubygems shipped with your mac. What I do recommend is:

  1. Installing homebrew and using that to manage software packages on your mac.
  2. Install brewbygems, which makes homebrew play nice with rubygems: gem install brewbygems
  3. Install rvm and learn to love the different versions of ruby and rvm's gemsets feature: gem install rvm

Once you've done that you'll have a pretty robust development environment and you should be able to install any version of rails without a problem. Just keep in mind rails 3 works best using ruby 1.9.2 (install with rvm by running rvm install ruby-head) and is still in beta, meaning it isn't terribly stable and should not be used for anything production grade (yet).

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Damien Wilson
  • 4,540
  • 3
  • 21
  • 27
0

I found the same error message, while after some google I've successfully installed it by manually 'sudo mkdir lib' in the .../gems/rails-3.0.0.beta3. Though it hasn't raised further problem, I hope someone could tell what should be in the missing lib directory.

0

You don't really need to do this sudo gem install rails --pre, simply sudo gem install rails. Rails3 is the default package now and out of beta.

It should work fine.

zengr
  • 38,346
  • 37
  • 130
  • 192
  • please read before downvoting and commenting. This is a 6 month old question and at that time, the only option was `sudo gem install rails --pre`. But when I posted my answer, rails3 was default and you didn't need to append --pre! – zengr Oct 30 '10 at 12:07
  • @balupton explanation please? – zengr Oct 30 '10 at 21:22
  • Running `sudo gem install rails` two weeks ago caused the exact same problem the asker was experiencing. `sudo gem install rails --pre` didn't work either - this is with Rails 3.0.1. Hence the down vote, as all your answer said was do the same thing that's causing the problem and it should work. – balupton Oct 31 '10 at 06:01
  • every one answered do install rails because, there was no accurate answer as per today's rails distribution. – zengr Oct 31 '10 at 06:42
0

Might be a different solution on your OS, but I got the same exact error in Ubuntu and creating a ¨lib¨ folder under the rails gem folder solved my problem. I have explained the solution in the following post:

Installing Rails: "File not found: lib"

For convenience I will copy it here as well. The solution:

mkdir /lib/ruby/gems/1.8/gems/rails-{whatever your version is}/lib

Explanation: The ¨[sudo] gem install rails¨ command expects the /lib folder (at the end) but for some reason it hasn´t been created yet.

The original source of this solution was the following URL. Hope it helps!

http://www.spritle.com/blogs/?p=915

Community
  • 1
  • 1
Amin Ariana
  • 4,635
  • 2
  • 35
  • 21
-1

Same problem with beta 4.

The workaround is sudo gem install rails --pre --no-ri --no-rdoc though I don't know why.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Mark Richman
  • 28,948
  • 25
  • 99
  • 159