After installing Ruby and Ruby Gems:
$ sudo apt-get install ruby rubygems
...
$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
$ gem -v
1.3.7
If I try to install Rails I get an error, and even though it seems to be the documentation only, rails
isn't installed:
$ sudo gem install rails
...
Successfully installed rails-3.0.1
24 gems installed
...
Installing ri documentation for builder-2.1.2...
ERROR: While generating documentation for builder-2.1.2
... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op /var/lib/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation
(continuing with the rest of the installation)
...
Installing ri documentation for rails-3.0.1...
File not found: lib
$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Ubuntu repositories only have Rails 2.3.5 so that isn't an option.
How do I get Rails to install properly?
Update: I tried the following, no error this time, but still no success:
$ sudo gem install rails --no-rdoc --no-ri
Successfully installed rails-3.0.1
1 gem installed
$ rails -v
The program 'rails' is currently not installed...
Update 2: So, thanks to Maran and Jörg, I now know the problem is not that rails
isn't installed, but it's not added to the PATH
. This can be fixed by adding the following to ~/.bashrc
:
export PATH=/var/lib/gems/1.8/bin:$PATH
That raises a further question: What should have added that to the PATH
? Presumably the apt-get install rubygems
? And what else may be broken?
I very strongly suggest you skip the Ubuntu packages and use RVM. The install process is pretty straight forward and documented. There is also a Railscast on it.
RVM will allow you to install multiple versions and create custom gemsets (no dependency problems). It is WELL worth it and quickly becoming the de-facto way to develop (and deploy) with Ruby.
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/:
Under no circumstance should you install Ruby, Rubygems or any Ruby-related packages from apt-get. This system is out-dated and leads to major headaches. Avoid it for Ruby-related packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With