4

I have successfully installed ruby1.9.1 but after downloading the .tgz archive offered here and doing

sudo ruby1.9.1 setup.rb

I get this:

/home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems/source_index.rb:62:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems/source_index.rb:52:in `from_installed_gems'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems.rb:914:in `source_index'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems/gem_path_searcher.rb:98:in `init_gemspecs'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems/gem_path_searcher.rb:13:in `initialize'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems.rb:873:in `new'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems.rb:873:in `searcher'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems.rb:495:in `find_files'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems.rb:1034:in `load_plugins'
from /home/elliot/Downloads/rubygems-1.4.1 (2)/lib/rubygems/gem_runner.rb:84:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from setup.rb:25:in `<main>'

Why is installing RubyGems with Ruby1.9.1 so painful? How can I install it correctly? Thanks in advance, ell.

Jorge Castro
  • 71,754
ell
  • 302

3 Answers3

1

Just like with python (and Java) if you use the default installation on a Debian based system you will get massive problems. Every language seems to want to make a big deal about having an automated system for installation, instead of working with existing systems.

The real solution is to install ruby and rubygems via apt and if the packages don't exist then you create the packages and host them in a ppa for others to install.

0

$ sudo apt-get install ruby1.9.1 gem1.9.1

personally I suggest ruby 1.9.2p94 or above since 1.9.2p0 has socket library bugs.

Note $ sudo apt-get install ruby1.9.2 gem1.9.2 installs a binary ruby1.9.1 however when you run ruby1.9.1 -v it tells you ruby 1.9.2. I filed a bug with ubuntu and they closed it saying they don't care.

  • 1
    I don't think gem1.9.1 exists, I get: "Unable to locate package gem1.9.1" – ell Jan 02 '11 at 19:51
  • you're right. The package name is rubygems1.9.1. I looked it up with apt-cache search ruby gem hope that helps for the future. It appears the rubygem might be a meta package. installing ruby1.9.1 should install gem1.9.1 as well. you can always dpkg -l | grep gem to see what installed packages there are on the local host. using apt-cache search to see the available packages from known sources. – EnabrenTane Jan 02 '11 at 23:54
0

If you're interested in using the latest versions of Ruby (I'd suggest using 1.9.2 as it's the latest stable version), then the best way I've seen of achieving this is to use rvm.

  • Can you provide a tutorial on installing rvm? I'm new on ubuntu and I have never understood git or svn or anything like that. – ell Jan 02 '11 at 19:54
  • There's decent installation documentation for RVM on their site at http://rvm.beginrescueend.com/rvm/install/ . The main gotcha I've seen with installing it is, don't use sudo for anything if you're doing the standard install. It goes into your home directory so there should be no need... – Rory McCune Jan 03 '11 at 09:17