Install RubyGems from irb

I started using NetBeans recently. And find it’s ruby support superb! (as far as an IDE can go). But there was an error installing gems with their gui manager, medicine and I was wondering how to debug that.

A quick peek into ruby/bin/gem revealed much of what I needed to know.

Lets demonstrate :

Welcome to the JRuby IRB Console

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> Gem.manage_gems
=> true
irb(main):003:0> gem = Gem::GemRunner.new
=> #
irb(main):004:0> gem.run(['help', health 'commands'])
GEM commands are:

build            Build a gem from a gemspec
cert             Adjust RubyGems certificate settings
check            Check installed gems
...
=> nil
irb(main):005:0>

update: The bug that prevented me from installing gems, turned out to be a _gemrc file that had http_proxy configured. A proxy no longer in use, but since I didn’t use gems all that much on this workstation before – I forgot all about it.

One thought on “Install RubyGems from irb

Leave a Reply

Your email address will not be published. Required fields are marked *