Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't gem install rails

This question has been asked many times before but it seems everyone else is trying it on OS X. I'm on Ubuntu.

Here's what I get when I try to sudo gem install rails:

$ sudo gem install rails
Successfully installed rails-3.0.3
1 gem installed
Installing ri documentation for rails-3.0.3...
file 'lib' not found
Installing RDoc documentation for rails-3.0.3...
file 'lib' not found

What do I have to do to get it to work?

I know it's not working because of this:

$ rails
The program 'rails' is currently not installed.  To run 'rails' please ask your administrator to install the package 'rails'
like image 569
Jason Swett Avatar asked Dec 30 '10 16:12

Jason Swett


People also ask

What is gem install command?

The install command installs local or remote gem into a gem repository. For gems with executables ruby installs a wrapper file into the executable directory by default. This can be overridden with the –no-wrappers option.


3 Answers

Try the following:

$ gem environment

and

$ echo $PATH

Ensure that your EXECUTABLE DIRECTORY shows up in your $PATH variable. If it doesn't, add it in your shell startup files. (eg. your .profile)

like image 111
ghoppe Avatar answered Sep 30 '22 05:09

ghoppe


It's working, as indicated by the 1 gem installed line.

The error messages you're getting is because the Rails documentation won't generate--many gems have similar problems with their auto-documenting feature. This won't impair the functionality of the gem, and chances are you'll go to api.rubyonrails.org for documentation anyway.

If the Rails installation actually failed, you'd see something along the lines of (might vary--the example below is from a native extension which may differ):

ERROR:  Error installing rails:

[stacktrace]

Gem files will remain installed in /path/to/Ruby/Gems/1.8/gems/rails-3.0.3 for inspection.
Results logged to /path/to/Ruby/Gems/1.8/gems/rails-3.0.3/ext/gem_make.out

If you check gem list, Rails will be in the list.

like image 33
vonconrad Avatar answered Sep 30 '22 06:09

vonconrad


I solved it by installing rdoc, like this. However you are on Ubuntu and I'm on Mac.

Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rails
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.1.0.gem (100%)
Fetching: activesupport-3.2.1.gem (100%)
...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for railties-3.2.1...
Installing RDoc documentation for bundler-1.0.22...
Installing RDoc documentation for rails-3.2.1...
file 'lib' not found
Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rdoc
Fetching: rdoc-3.12.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-3.12
1 gem installed
Installing ri documentation for rdoc-3.12...
Installing RDoc documentation for rdoc-3.12...
Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
Simon-Strandgaards-Mac-mini:Desktop neoneye$
like image 44
neoneye Avatar answered Sep 30 '22 06:09

neoneye