views:

66

answers:

5

I've installed Ruby (1.8.7 via apt-get) and I installed Rails (2.3.2 via rubygems) but when I type 'rails newapp', I get this error:

The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails
rails: command not found

When I run 'gem list' it shows rails and all of it's dependencies. Any idea what might have gone wrong?

+1  A: 

Do you have multiple version of ruby or rubygems installed?

Type which ruby and which gem to confirm that you are using the correct binaries.

Jeremy
+2  A: 

Using debian ruby packages is going to be misery, for more reasons than just the path issue you currently have. I recommend using rvm instead. rvm allows you to easily install new versions of ruby or even bounce back and forth between multiple installed versions (even jruby) and it will always fix your path appropriately so everything you need is in your path.

  1. Remove all debian ruby packages
  2. Install and configure rvm
  3. rvm install ruby-1.8.7
Mark Thomas
Don't I need to install ruby + rubygems on my system before rvm? What's the best way to do this if debian packages aren't recommended?
585connor
No, you don't need ruby or rubygems. rvm will install and manage them for you. Try it! It makes everything really easy.
Mark Thomas
A: 

How did you install rubygems? I've found problems when using it through the ubuntu repositories in the past. Usually I remove that package and compile and install

sudo apt-get remove rubygems
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7/
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

or you may just have to symbolic link it:

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Nick
+2  A: 

rubygems' binary directories are not automatically included in the PATH. Also, you may try asking any Debian-related questions on Debian Q&A.

Luca Brivio