Why is echo $PATH telling me that rails is in a different directory
than it actually is? And how can I get terminal to recognize the
command?
locate has nothing to do with $PATH, and echo $PATH doesn’t tell you
anything about where rails is; it tells you the value of your shell’s
$PATH variable. To find out where your shell thinks rails is, say:
which rails
If rails is not in your $PATH, the reply will be something like:
no rails in /usr/local/bin /usr/local/sbin /usr/local/mysql/bin /bin
/sbin /usr/bin /usr/sbin
To find out where rails really is, say:
find /usr -name “rails”
I suspect you need to sort out your $PATH. The fact that $PATH knows
nothing of, say, mysql suggests to me that whatever file it is you’ve
edited, it’s the wrong file. OMM, the thing to edit is .bash_profile
(but of course YMMV)…
Of course, this is going to take forever. If locate tells you a
location, try that. If rails isn’t there, run sudo updatedb and try
again.
It’s pretty much only ever going to end up in a handful of places
(unless you’re on a really weird platform). /usr/bin, /usr/local/bin,
/opt/local/bin (mac with dports)…
If you have to use find, pass in -type f:
find /usr -type f -name rails
Which’ll only find files, and run quicker than without.