tags:

views:

74

answers:

6

I wanted to install ruby 1.9.1 instead of the older version so I ran this command on Ubuntu:

sudo apt-get install ruby1.9.1-full

After the install was complete, I got the following error(s):

WARNING: Installing to ~/.gem since /var/lib/gems/1.9.1 and /var/lib/gems/1.9.1/bin aren't both writable. WARNING: You don't have /home/brooks/.gem/ruby/1.9.1/bin in your PATH, gem executables will not run.

When I run "ruby -v" (without the quotes) I get the following response:

bash: /usr/bin/ruby: No such file or directory

So my questions are: 1) Why is it so difficult to install ruby, 2) How can I resolve this problem?

Thank you for your help!

Br

A: 

1) Why is it so difficult to install ruby

So difficult?

2) How can I resolve this problem?

Synaptic lists Ruby1.9.1 does that install okay?

Here's the Ruby 1.9.1-p378 tarball - you could try ye olde ./configure && make && make install

igouy
Yeah, for some reason it doesn't recognize ruby - even after I install it. If I do ruby -v it doesn't return the version of ruby, it gives me an error stating that it can't find the ruby executable.
Because the Ruby executable is `ruby1.9.1` in the Debian package. You can easily make your own `ruby` executable with a symlink.
Justice
+1  A: 

After the install was complete, I got the following error(s):

Those aren't errors. They're warnings issued by rubygems. If you want to avoid them run rubygems with sudo or add add /home/brooks/.gem/ruby/1.9.1/bin to your PATH variable. Or if you don't care that you can't run executables installed by gems without specifying the whole path, just ignore them.

When I run "ruby -v" (without the quotes) I get the following response:

bash: /usr/bin/ruby: No such file or directory

Try ruby1.9.1 -v

sepp2k
Yes! When I did "ruby1.9.1 -v" instead of "ruby -v" (without quotes) it returned this: "ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux]" That lets me know it works. Now, I want my system to know that ruby1.9.1 is the default... how do I do this? I still can't use rails.
+1  A: 

On my Ubuntu, /usr/bin/ruby is ruby1.8. /usr/bin/ruby1.9 is ruby1.9 and /usr/bin/ruby1.9.1 is ruby1.9.1

It's a good idea to leave /usr/bin/ruby as ruby1.8 as there may be system programs that expect it to be ruby1.8

gnibbler
A: 

I used rvm link text to install ruby 1.9.1 and then 1.9.2

Rambler
I think you meant ..."rvm http://rvm.beginrescueend.com/"...
Greg
A: 

To solve this problem:

  1. sudo apt-get remove ruby ruby1.9.1-full
  2. Download and decompress ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.1-p378.tar.gz.
  3. cd ruby-1.9.1-p378
  4. ls configure - if there isn't a "file not found" error, skip to step 6.
  5. autoconf
  6. ./configure - if there are any errors, post them in a comment.
  7. make
  8. sudo make install
  9. which ruby - if there is any output, do not go on.
  10. which ruby-1.9.1 or which ruby1.9.1 - There should be output from one of those.
  11. cd to the directory revealed by step 10.
  12. sudo ln -s <your_ruby> ruby, where <your_ruby> is whichever command in step 10 produced output, either ruby-1.9.1 or ruby1.9.1.
  13. repeat step 12, replacing ruby for gem, irb, ri, and rdoc. So one might be sudo ln -s gem-1.9.1 gem.

If you get the same WARNING: Installing to ~/.gem since...:

  1. nano ~/.profile
  2. append this:

.

export PATH=/home/brooks/.gem/ruby/1.9.1/bin:$PATH
export GEM_HOME=/home/brooks/.gem/ruby/1.9.1

Again, if there are any errors, post them in a comment on this answer.

Adrian
Maybe not appropriate given the op's familiarity with Linux?
Chris McCauley
Where does it say they are familiar with Linux? Just because they use Ubuntu does not mean they are familiar with it.
Adrian
Once you've given rvm a try, you'll never want (nor need) to go through all this hassle again.
Lars Haugseth
+2  A: 

On my Linux systems I ignore apt-get for Ruby, except for the default ruby package that goes into /usr/bin. I will load any other version, like 1.8.7-head or 1.9.1-whatever using RVM into my own space if it's just for me.

If the ruby being installed is system-wide I will use a source tarball and install into /usr/local/bin and adjust my path or the #! line in the source code to determine which version I want invoked.

In my experience Ruby is easy to install on Ubuntu or any Linux as long as I don't use the packages. I know that hurts the feelings of the package maintainers but I haven't found their fruits to be to my taste very often.

For the average user I highly recommend RVM for development and testing as you can have multiple rubies installed and jump back and forth easily by using a #!/usr/bin/env ruby invocation and letting RVM adjust the version I'll run against by doing a rvm use 1.8.7 or rvm use 1.9.1. Or, you can run commands against each installed instance by using rvm ruby .... RVM is a great piece of software and Wayne should be knighted. :-)

Greg
+1 for suggesting rvm. (http://rvm.beginrescueend.com/)
Lars Haugseth