开发者

Ruby 1.9.1 isn't recognized on Ubuntu

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 开发者_StackOverflow社区/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


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


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. :-)


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


You need to update your alternatives for ruby. Try

sudo update-alternatives --config ruby

If you don't already have an option for a particular version you have installed, see this post: http://ubuntuforums.org/showpost.php?p=10057489&postcount=6


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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜