[MacRuby-devel] macgem and previously installed gems

Rob Gleeson rob at flowof.info
Sun Nov 7 09:57:58 PST 2010


On 31 Oct 2010, at 01:16, Andy Park wrote:

> I'm trying to get macirb that came with my new MacRuby installation to play nice
> ly with the existing .irbrc, where I'm using a lot of gems previously installed 
> with gem. It looks like my gems aren't found by macirb because they were install
> ed with gem, so are not found / used by macgem. Would I really need to install a
> ll my gems using macgem in order to work with macirb using my existing .irbrc?
> 

Yep. Gem installations are contained within the installation directory of the Ruby interpreter you're using.

A possible solution to your problem could be something like this:

  unless defined?(RUBY_ENGINE) 
    # require gems for the Ruby interpreter bundled with OSX.
  else
    # require gems for use with MacRuby.
  end

Ruby 1.8 doesn't define RUBY_ENGINE as far as I know, but 1.9 and other Ruby implementations do(rbx, JRuby, …)

The Ruby Version Manager(RVM) does a much better job at handling multiple Ruby installations(MacRuby included), so 
maybe you can have a look at that too: http://rvm.beginrescueend.com

HTH,
Rob.







More information about the MacRuby-devel mailing list