Ubuntu / The program 'rails' is currently not installed

From WhyNotWiki
Jump to: navigation, search

When I tried running the rails command after sudo apt-get install ruby irb rdoc ri ruby1.8-dev libzlib-ruby libopenssl-ruby rubygems, sudo gem install rails -y, I was puzzled as to why I was getting this error...

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

I searched Google for: program 'rails' is "currently not installed" ubuntu

and sure enough, the first result was actually helpful:

http://www.kimballlarsen.com/techie_mumbo_jumbo/installroronubuntufeisty.html. Retrieved on 2007-05-11 11:18.

But, didn't we install it? And what's with this package? I thought we used a gem to install it...? So, now we have a dilemma, and since I'm writing this as I go along, I'm going to have to make a decision and document the results, blithely ignoring the fact there are other ways to do this. Typically I prefer to use the built in package manager to handle all my software installs, but in this case, I'll make an exception and keep the version of rails that was installed via gem. This means I'm going to have to update my path to include the correct location for the rails binaries I'll need. A quick spelunking trip into my filesystem reveals that they are installed here:

root# locate rails | grep bin

...
/var/lib/gems/1.8/bin/rails
...

So, there is a rails binary in /var/lib/gems/1.8/bin/. I can add /var/lib/gems/1.8/bin to my path by editing /etc/profile and adding the following after the first comment lines:

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

I guess Debian/Ubuntu is weird and installs Ruby gem binaries to /var/lib/gems/1.8/bin instead of /usr/bin where I was used to (is that just where Fedora puts it or what?) ... you know, I think I actually like it there better! Who woulda thought it eh?

Ads
Personal tools