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?

···

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

Pen Ttt 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 before so
it has to look like:
  sudo ./configure --prefix=/usr/local/ruby
Third what is an output of <code>ls -l /usr/local/ruby/bin/ruby</code> ?

···

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

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

···

On Sun, Nov 21, 2010 at 7:43 AM, Pen Ttt <myocean135@yahoo.cn> wrote:

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?

--
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"

···

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

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 <selected package>
what's wrong?

···

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

$ 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

···

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

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 <link-target> <where-to-install-the-link>

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.

···

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

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.

···

On Nov 21, 2010, at 17:42 , Pen Ttt 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

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"

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?

···

Pen Ttt <myocean135@yahoo.cn> wrote:
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

typing "irb" & pressing TAB doesn't get you anywhere?

···

On Mon, 2010-11-29 at 21:04 +0900, Pen Ttt 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 <selected package>
what's wrong?

How did you install ruby?

- Lucas

···

On 29/11/10 at 21:04 +0900, Pen Ttt 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 <selected package>
what's wrong?

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

best regards -botp

···

On Mon, Nov 29, 2010 at 8:04 PM, Pen Ttt <myocean135@yahoo.cn> 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 <selected package>
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

···

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

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

···

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

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

···

On Mon, Nov 29, 2010 at 1:21 PM, Pen Ttt <myocean135@yahoo.cn> wrote:

"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

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

--
Peter Vandenabeele
gsm: +32-478-27.40.69
e-mail: peter@vandenabeele.com
http://twitter.com/peter_v

Then ruby isn't in your $PATH.

Have you tried your distribution's packages?

- Lucas

···

On 29/11/10 at 21:31 +0900, Pen Ttt 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

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

···

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

(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

···

On Mon, Nov 29, 2010 at 1:43 PM, Pen Ttt <myocean135@yahoo.cn> 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