Ruby is not accessible from the my terminal

My Ubuntu Software Center shows Ruby 1.8 “Installed” but Ruby is not
accessible from the my terminal:

$ ruby -v
The program ‘ruby’ is currently not installed. You can install it by
typing:
sudo apt-get install ruby
$ printenv PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/wolf/.gem/ruby/1.8/bin
$ cucumber codebreaker_starts_game.feature
Feature: code-breaker starts game

Cucumber is a Ruby framework. Cucumber is working but Ruby does not.
How is that possible? How can I run Ruby from my terminal?

Thank you.

On Mon, Feb 14, 2011 at 12:26 AM, wolf volpi

$ printenv PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/wolf/.gem/ruby/1.8/bin

$ cucumber codebreaker_starts_game.feature
Feature: code-breaker starts game

Cucumber is a Ruby framework. Cucumber is working but Ruby does not.
How is that possible? How can I run Ruby from my terminal?

View the cucumber source (which cucumber will tell you where it is)
and see how it’s invoking ruby.

martin

Martin DeMello wrote in post #981436:

On Mon, Feb 14, 2011 at 12:26 AM, wolf volpi

$ printenv PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/wolf/.gem/ruby/1.8/bin

$ cucumber codebreaker_starts_game.feature
Feature: code-breaker starts game

Cucumber is a Ruby framework. Cucumber is working but Ruby does not.
How is that possible? How can I run Ruby from my terminal?

View the cucumber source (which cucumber will tell you where it is)
and see how it’s invoking ruby.

martin

Thanks martin. Here is what I found:

$ which cucumber
/home/wolf/.gem/ruby/1.8/bin/cucumber
$ more /home/wolf/.gem/ruby/1.8/bin/cucumber
#!/usr/bin/ruby1.8

This file was generated by RubyGems.

The application ‘cucumber’ is installed as part of a gem, and

this file is here to facilitate running it.

require ‘rubygems’

version = “>= 0”

if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end

gem ‘cucumber’, version
load Gem.bin_path(‘cucumber’, ‘cucumber’, version)

Now where do I go from here?

On Mon, Feb 14, 2011 at 12:48 AM, wolf volpi [email protected]
wrote:

$ which cucumber
/home/wolf/.gem/ruby/1.8/bin/cucumber

Thanks martin. Now where do I go from here?

$ head /home/wolf/.gem/ruby/1.8/bin/cucumber

It should have a first line of the form

#!/usr/bin/ruby

which will tell you where exactly cucumber is running ruby from.

martin

You have the ruby18 and irb18 packages installed, but not ruby and irb
(which install links to these names)

Try:
sudo apt-get install ruby irb

  • which is of course exactly what Ubuntu was telling you to do.

(I am assuming this is ubuntu 10.04; it’s changed for 10.10, there is
thankfully less fragmentation of the ruby packages)

Martin DeMello wrote in post #981441:

It should have a first line of the form

#!/usr/bin/ruby

which will tell you where exactly cucumber is running ruby from.

martin

Yeh, it works!

$ head /home/wolf/.gem/ruby/1.8/bin/cucumber
#!/usr/bin/ruby1.8
$ /usr/bin/ruby1.8 -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

Now I try interactive ruby as described in
http://www.ruby-lang.org/en/documentation/quickstart/

$ irb
The program ‘irb’ is currently not installed. You can install it by
typing:
sudo apt-get install irb

But my Ubuntu Software Center shows irb 1.8 “Installed”. How can I get
irb to run?

Is Ruby usually this difficult to setup on Ubuntu? Are there some magic
instructions I missed?

Thank you.

Brian C. wrote in post #981455:

You have the ruby18 and irb18 packages installed, but not ruby and irb
(which install links to these names)

Try:
sudo apt-get install ruby irb

  • which is of course exactly what Ubuntu was telling you to do.

(I am assuming this is ubuntu 10.04; it’s changed for 10.10, there is
thankfully less fragmentation of the ruby packages)

Brian,

irb worked after “sudo apt-get install ruby irb”.
And yes, I am using Ubuntu 10.04.

Thank you for your assistance.