-bash: rails: command not found

Whats going on here?

I’m following a tutorial from a book… which is slightly biased towards
Windows.
However, I am just translating the commands to use them in the terminal
on my Mac (10.4)

Maybe I’m not suppose to type it in the terminal - But it just seems
like common sense. Am I wrong?

I open up the terminal and switch to the directory that I am working in
called “rubydev”:

shane-killians-computer:~ shanekillian$ cd r*
shane-killians-computer:~/rubydev shanekillian$

I then tell rails to create an application called “hello” and I get:

shane-killians-computer:~/rubydev shanekillian$ rails hello
-bash: rails: command not found
shane-killians-computer:~/rubydev shanekillian$


Now, I have gone through the install on
Dan Benjamin and
I am certain that everything is right!

I have installed MySQL and also installed CocoaMySQL (I haven’t tried
using CocoaMySQL yet - But I assume I just need to connect it to
“localhost”)


As far as I know I have installed (in no particular order:
Ruby Gems
Ruby
Rails
MySQL & Native Bindings for Intel Mac
Capistrano
Subversion
Mongrel

Is there something I’m missing here perhaps?

I checked my version of ruby:

shane-killians-computer:~ shanekillian$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]
shane-killians-computer:~ shanekillian$

I’m sure you can imagine this is very frustrating.

I can only assume that I can use a similar command to check the version
of rails? So I type:

shane-killians-computer:~ shanekillian$ rails -v
-bash: rails: command not found
shane-killians-computer:~ shanekillian$

If this is the correct command would I be right to say that rails is not
installed - or there is a problem with my installation?

Is there anyway that I can double check that everything is right.

Please note:
I am assuming that all of these commands need to be run from the
terminal - I can’t see why they would be run anywhere else.

All help is greatly appreciated!
I’m pulling my hair out here … HOWEVER, I AM A FAR CRY FROM GIVING
UP!
I refuse to let it get the better of me!

Shane, from that same directory type in
gem list

If it lists rails in the gems from that directory, you should be good
to go.
If the list is long, you can narrow it with:
gem list ra

That will only list gems starting with ra

You may need to set your paths.
This is important. double check it with the Hivelogic tutorial.
Also there is now a Ruby 1-click-installer for OS X
Regardless, you may likely have a path issue.

So I type:

shane-killians-computer:~ shanekillian$ rails -v
-bash: rails: command not found

Shane,
You’re absolutely right: both the “rails -v” and “rails hello” command
should work. And you DO use Terminal’s command line.

The problem is your $path variable doesn’t know about the directories
containing rails or ruby. Look back at the Hivelogic article about
halfway down where it talks about “paths”. (What it DOESN’T say is
that the syntax to set your paths varies depending upon which shell
you’re using. Terminal will tell you: it will be either “tcsh” or
“bash”. Looks like you’re using bash.)

Google “path Unix” to learn more about setting this variable. To find
out what your path is now, type “echo $path”, and it will tell you.

Any time you’re not sure if your shell knows about a command, type
“which ”, and it will list the directory containing the
command. If there’s no such command, it will say “command not found.”

The easiest way to get around having to learn about the Unix shell on
the Mac is to download and install Locomotive (http://
locomotive.raaum.org/). It handles all the path stuff for you, and a
great deal more besides.

—Jim Gagne—

Thanks for the help everyone.

I got it installed. After I was able to find where to install it I
realised that it was an issue with permissions.

So obviously I had to sudo the command to install it and it worked.