[MacRuby-devel] Fwd: How do I get gems into XCode/MacRuby environment?

Paul Davis peedeemail at gmail.com
Tue Apr 19 13:30:58 PDT 2011


Ah. Thanks Morgan. That indeed has things working. I had thought MacRuby was running on 1.9.x - probably because the first line on http://www.macruby.org is "MacRuby is an implementation of Ruby 1.9 directly on top of Mac OS X core technologies...".

In fact, when I run "puts system('ruby -v')" from inside a MacRuby/XCode process I get:
	"ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]"

Setting the GEM_HOME and GEM_PATH in the Scheme to point to my 1.8.7 gems has them loading and running.

Still haven't tested deploy.

PD

On 16-Apr-11, at 7:02 AM, Morgan Schweers wrote:

> Greetings,
> Interesting; I actually eschew rvm for macruby stuff, so I use 'rvm system' whenever I want to interact with MacRuby, otherwise the gems get confused.
> 
> --  Morgan
> 
> On Thu, Apr 14, 2011 at 8:59 PM, Paul Davis <peedeemail at gmail.com> wrote:
> Okay, one elegant way to do make gems visible to MacRuby in XCode4 is to add environment variables GEM_HOME and GEM_PATH in the "Scheme".
> 
> If you have ruby 1.9.2 installed via rvm (rvm.beginrescueend.com) as I do, type:
> 	>rvm 1.9.2
> 	>rvm info
> 
> Look for the GEM_HOME and GEM_PATH values, and add these into the Environment Variables table in the Arguments tab of the XCode/Scheme/Edit Scheme dialog (whew!).
> 
> Then just install whatever gems you need at the command line within rvm.
> 
> PD
> 
> Begin forwarded message:
> 
>> From: Paul Davis <peedeemail at gmail.com>
>> Date: 15 April 2011 7:24:50 AM NZST
>> To: macruby-devel at lists.macosforge.org
>> Subject: Re: [MacRuby-devel] How do I get gems into XCode/MacRuby environment?
>> 
>> Good suggestion.
>> 
>> macgem install hpricot # installs the gem (apparently)
>> macgem list --local    # now shows rake and hpricot as the only two local gems...
>> 
>> After experimentation this appears to be because these are the only two loaded under rvm for ruby 1.9.2. "macgem list --local" is just picking up whatever gems are in the currently selected rvm environment, but not all of these are showing up in XCode.
>> 
>> Code snippet in rb_main.rb:
>>> ['rubygems', 'pp', 'rake'].each {|gem|
>>>  puts "Loading '#{gem}'... #{require gem}" #=> true
>>> }
>>> system ('macgem list --local')
>> 
>> 
>> ==>
>> 
>>> Loading 'rubygems'... true
>>> Loading 'pp'... true
>>> Loading 'rake'... true
>>> 
>>> *** LOCAL GEMS ***
>>> 
>>> 
>>> applicationDidFinishLaunching
>> 
>> 
>> More testing later.
>> 
>> On 15-Apr-11, at 2:00 AM, macruby-devel-request at lists.macosforge.org wrote:
>> 
>>> Try using "macgem". All of the MacRuby binaries are prefixed with "mac-"
>>> (macruby, macirb, macri, etc.)
>>> 
>>> On Thu, Apr 14, 2011 at 1:44 AM, Paul Davis <peedeemail at gmail.com> wrote:
>>> 
>>>> I'm past the Hello World tutorial, and want to try something useful but I
>>>> cannot seem to access my gems from within the XCode/MacRuby environment.
>>>> rubygems is there, as is pp; but not, for instance hpricot.
>>>> 
>>>> $gem list --local
>>>> ...
>>>> hpricot (0.8.1, 0.6.164)
>>>> ...
>>>> rack (1.0.1)
>>>> rails (2.3.5, 2.3.4, 1.2.6)
>>>> ...
>>>> 
>>>> Within rb_main.rb:
>>>> 
>>>> puts "Loading rubygems... #{require 'rubygems'}" #=> true
>>>> puts "Loading pp... #{require 'pp'}" #=> true
>>>> 
>>>> but
>>>> 
>>>> puts "Loading hpricot... #{require 'hpricot'}"
>>>> 
>>>> gets me "no such file to load -- hpricot (LoadError)"
>>>> 
>>>> Any hints? Do I need to hunt down the full path?
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>> 
>>> 
>> 
> 
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110420/8806634b/attachment.html>


More information about the MacRuby-devel mailing list