views:

2318

answers:

5

I'm trying to install rails on Ubuntu 9.10.

gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.4, 2.3.2)
actionpack (2.3.4, 2.3.2)
activerecord (2.3.4, 2.3.2)
activeresource (2.3.4, 2.3.2)
activesupport (2.3.4, 2.3.2)
rack (1.0.1)
rails (2.3.4, 2.3.2)
rake (0.8.7)
sqlite3-ruby (1.2.5)

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

How do I solve this?

+10  A: 

You need to add /var/lib/gems/1.8/bin to your PATH. Try this command:

export PATH=$PATH:$HOME/bin:/var/lib/gems/1.8/bin

After that rake should work.

You can add this line to your ~/.bashrc so that you don't have to type in this command each time.

Siddhartha Reddy
THANKYOUTHANKYOUTHANKYOU I have been having this problem for MONTHS and stumbled over this Q on accident...
Chris McCall
+1  A: 

Gem is complaining about the rake program (i.e. executable), not the rake gem (you have the latter already installed).

That means that you have to add rake exec to the PATH. Possible rake bin location is /var/lib/gems/1.8/bin/rake. Add it to your PATH then:

export PATH=${PATH}:/var/lib/gems/1.8/bin

You can also install Rake from the Ubuntu repository (as suggested in the gem output):

sudo apt-get install rake
Henryk Konsek
A: 

They are correct, you need to have rake in your path. However if you want to make sure it's just there, instead of exporting it from .bashrc, make a symbolic link:

sudo ln -s /var/lib/gems/1.8/bin/rake /usr/bin/rake

If you do that, you should always be able to use it.

anotherdjohnson
This doesnt seem to work for sudo rake
Sam
A: 

I ran into the same problem on Centos 5.5 and self compiled ruby and rails. (Need it for redmine) When i tried to install passenger using passenger-install-apache2-module, I did an strace and round out, that passenger looks for rake in the ruby/bin directory and not the gems/bin directory, where rake was installed. So a

ln -s /usr/local/ruby1.8.7/lib/ruby/gems/1.8/bin/rake /usr/local/ruby1.8.7/bin

solved it for me. (/usr/local/ruby1.8.7 is where i installed ruby...)

sumpfgottheit
+1  A: 

This is the kind of issue i have to remember. Everytime i set a new ubuntu machine i run into this little problem. BTW the solution, at least for me, is making the symbolic link.

lucapette