Question

On CentOS, I did a manual install of Ruby 1.9.3 from a tar file. I received no errors during the ./configure make and make install.

"which ruby" outputs "/usr/local/bin/ruby"

"whereis ruby" outputs "ruby: /usr/lib/ruby /usr/lib64/ruby /usr/local/bin/ruby /usr/local/lib/ruby"

"ruby -v" outputs "-bash: /usr/bin/ruby: No such file or directory"

echo $PATH outputs /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/dell/srvadmin‌​/bin:/opt/dell/srvadmin/sbin:/root/bin so it appears /usr/local/bin is before /usr/bin

Was it helpful?

Solution

You need to edit your PATH environment variable to look in /usr/local/bin before /usr/bin.

See this answer for details.

Simplest is to edit/create ~/.profile with the line:

export PATH=/usr/local/bin:$PATH

which adds that directory to be the first it looks in. (And then either create a new shell, or source ~/.profile to re-run the commands in it.)

Edit: If /usr/local/sbin (the first item in your PATH) has a symlink for ruby pointing to /usr/bin/ruby, you should either remove this file, or create a new symlink, e.g.

$ cd /usr/local/sbin
$ sudo rm ruby
$ sudo ln -s /usr/local/bin/ruby
$ ls -l ruby
lrwxr-xr-x  1 root  root  19 Mar 18 09:01 ruby -> /usr/local/bin/ruby
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top