Why i can't find my ruby?

i installed ruby this way:
sudo wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
sudo tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure -prefix=/usr/local/ruby
sudo make && make install
sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
sudo gedit /etc/environment

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin”
when i restart,
pt@pt:~$ ruby -v
The program ‘ruby’ is currently not installed. You can install it by
typing:
sudo apt-get install ruby

could you mind to tell me how to resolve it?

Pen T. wrote in post #962916:

i installed ruby this way:
sudo wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
sudo tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure -prefix=/usr/local/ruby
sudo make && make install
sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
sudo gedit /etc/environment

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin”

when i restart,
pt@pt:~$ ruby -v
The program ‘ruby’ is currently not installed. You can install it by
typing:
sudo apt-get install ruby

could you mind to tell me how to resolve it?

First you have to check whether the compilation & installation process
did succeeded.
Second the target prefix for configure script has two hyphens in front
so
it has to look like:
sudo ./configure --prefix=/usr/local/ruby
Third what is an output of ls -l /usr/local/ruby/bin/ruby ?

On Sun, Nov 21, 2010 at 7:43 AM, Pen T. [email protected] wrote:

i installed ruby this way:
sudo wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
sudo tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure -prefix=/usr/local/ruby
sudo make && make install

First off you seem to be using sudo when it normally isn’t used and
not with it is.

Normally do all of the steps up to and including make as a normal user
and then do

sudo make install

and only if you are installing to a place which requires root
privileges. Using sudo unnecessarily is dangerous since you really
don’t know what those commands might do particularly the make

sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem

This is wrong, you are making /usr/local/ruby/bin/ruby point to the
system installed ruby and the same thing for the gem executable. I’m
not sure why you did this. If the make install worked it should have
made ruby and gem accessible via /usr/loca/bin, probably via symlinks.
And since you are setting the PATH environment variable to put
/usr/local/bin ahead of /usr/bin the shell should find your installed
ruby.

I suspect that what happened is that the make install failed because
you didn’t run it under sudo.

That all said, if it were me I’d install ruby using RVM


Posted via http://www.ruby-forum.com/.


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

thinks everyone.this right way is :
sudo wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
sudo tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure --prefix=/usr/local/ruby
sudo make
sudo make install
sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
sudo gedit /etc/environment

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin”

Rick Denatale wrote in post #962943:

sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem

This is wrong, you are making /usr/local/ruby/bin/ruby point to the
system installed ruby and the same thing for the gem executable.

That’s untrue. ln -s is
ln -s

And in any case, the OP didn’t have a system ruby anyway.

I would start with typing

/usr/local/ruby/bin/ruby -v

Does that work? If so, you want /usr/local/ruby/bin on your $PATH

If not, look at the configure and make output to see what went wrong.

That all said, if it were me I’d install ruby using RVM

Yes, that takes care of all this stuff and more.

On Nov 21, 2010, at 17:42 , Pen T. wrote:

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin”

Again, don’t blindly use sudo!

This should work just as well, and safer too:

cd
wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
tar jxvf ruby-1.9.2-p0.tar.bz2
cd ruby-1.9.2-p0
./configure --prefix=/usr/local/ruby && make && sudo make install
sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem

and since you’re making symbolic links to a directory that is already in
your PATH, you don’t need to edit your PATH in /etc/environment.

Pen T. [email protected] wrote:

thinks everyone.this right way is :
sudo wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
sudo tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure --prefix=/usr/local/ruby
sudo make
sudo make install
sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
sudo gedit /etc/environment

No, it’s not. You use sudo only when it is absolutely required, and as
with virtually every package you can download, the ONLY step here that
needs the sudo is the “make install”. You can build it as a normal
user.
So:

wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
tar jxvf ruby-1.9.2-p0.tar.bz2
cd ruby-1.9.2-p0
./configure --prefix=/usr/local/ruby
make
sudo make install

sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
sudo gedit /etc/environment

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin”

If you are adding /usr/local/ruby/bin to your path, then the two
symbolic
links are unnecessary. Further, if you want the links in /usr/bin, why
not
just skip the prefix altogether?

typing “irb” & pressing TAB doesn’t get you anywhere?

when i installed ruby,
pt@pt:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
pt@pt:~$ irb
The program ‘irb’ can be found in the following packages:

  • ruby
  • irb
    Try: sudo apt-get install
    what’s wrong?

“irb” +pressing TAB ,nothing happen
“irb” +pressing TAB + Space bar
pt@pt:~$ irb
.bash_history .local/
.bash_logout .mozilla/
.bashrc Music/
.cache/ .nautilus/
.compiz/ photo.tar.gz
.config/ Pictures/
.dbus/ .pki/
Desktop/ .profile
.dmrc Public/
Documents/ .pulse/
Downloads/ .pulse-cookie
.emacs.d/ .recently-used.xbel
.esd_auth ruby-1.9.2-p0/
examples.desktop ruby-1.9.2-p0.tar.bz2
.fontconfig/ .shotwell/
.gconf/ .sudo_as_admin_successful
.gconfd/ Templates/
.gksu.lock .thumbnails/
.gnome2/ vb
.gnome2_private/ Videos/
.gstreamer-0.10/ .VirtualBox/
.gtk-bookmarks .xinput.d/
.gvfs/ .xsession-errors

On 29/11/10 at 21:04 +0900, Pen T. wrote:

when i installed ruby,
pt@pt:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
pt@pt:~$ irb
The program ‘irb’ can be found in the following packages:

  • ruby
  • irb
    Try: sudo apt-get install
    what’s wrong?

How did you install ruby?

  • Lucas

wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
tar jxvf ruby-1.9.2-p0.tar.bz2
cd /home/pt/ruby-1.9.2-p0
sudo ./configure --prefix=/usr/local/ruby
sudo make
sudo make install

On Mon, Nov 29, 2010 at 8:04 PM, Pen T. [email protected] wrote:

when i installed ruby,
pt@pt:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
pt@pt:~$ irb
The program ‘irb’ can be found in the following packages:

  • ruby
  • irb
    Try: sudo apt-get install
    what’s wrong?

you only created a link for ruby & gem.
you need to create a link for irb too.

best regards -botp

You may try these 3 commands and report the result:

$ which ruby
$ ls -l which ruby
$ ls -l which ruby | sed -e 's/ruby//' | grep irb

In my case, the result is:

$ which ruby
/usr/bin/ruby
$ ls -l which ruby
lrwxrwxrwx 1 root root 43 2010-05-10 14:47 /usr/bin/ruby ->
/opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
$ ls -l which ruby | sed -e 's/ruby//' | grep irb
lrwxrwxrwx 1 root root 42 2010-05-10 14:48 irb ->
/opt/ruby-enterprise-1.8.7-2010.01/bin/irb
-rwxr-xr-x 1 root root 376 2010-03-19 18:45 irb1.8
lrwxrwxrwx 1 root root 6 2010-03-31 17:00 irb-ORIG -> irb1.8

What it does is:

  • use ‘which’ to find where you have ruby installed
  • list the details about ruby (e.g. a symlink)
  • search that same directory for the ‘irb’ command

That may give a hint where your ruby and irb are installed.

HTH,

Peter

pt@pt:~$ which ruby
/usr/bin/ruby
pt@pt:~$ ls -l which ruby
lrwxrwxrwx 1 root root 24 2010-11-29 16:00 /usr/bin/ruby ->
/usr/local/ruby/bin/ruby
pt@pt:~$ ls -l which ruby | sed -e 's/ruby//' | grep irb
pt@pt:~$

there is nothing for the last command
ls -l which ruby | sed -e 's/ruby//' | grep irb

On Mon, Nov 29, 2010 at 1:43 PM, Pen T. [email protected] wrote:

pt@pt:~$ which ruby
/usr/bin/ruby
pt@pt:~$ ls -l which ruby
lrwxrwxrwx 1 root root 24 2010-11-29 16:00 /usr/bin/ruby →
/usr/local/ruby/bin/ruby
pt@pt:~$ ls -l which ruby | sed -e 's/ruby//' | grep irb
pt@pt:~$

there is nothing for the last command
ls -l which ruby | sed -e 's/ruby//' | grep irb

(caveat, not actually tried, from memory).

So now try:

$ cd /usr/bin
$ sudo ln -s /usr/local/ruby/bin/irb irb

After that, the command:

$ ls -l which ruby | sed -e 's/ruby//' | grep irb

should show the symlink as on my computer.

and

$ which irb

should work.

You could also add to your .bashrc a line like:

PATH=/usr/local/ruby/bin:“${PATH}”

this wlll make all those command in /usr/local/ruby/bin available

HTH,

Peter

$ cd /usr/bin
$ sudo ln -s /usr/local/ruby/bin/irb irb
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin:/usr/local/ruby/bin:"${PATH}""
it’ok,think everyone

On 29/11/10 at 21:31 +0900, Pen T. wrote:

wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2
tar jxvf ruby-1.9.2-p0.tar.bz2
cd ruby-1.9.2-p0
sudo ./configure --prefix=/usr/local/ruby
sudo make
sudo make install

Then ruby isn’t in your $PATH.

Have you tried your distribution’s packages?

  • Lucas