[MacRuby-devel] Deploying a MacRuby.app with the GCD Dispatch gem

Arron Mabrey arron at mabreys.com
Fri Jan 7 13:31:04 PST 2011


Ernie P.

I got it fixed, but let me still answer your question.

> Silly question, but are you using "macgem" to install it where MacRuby expects it? Can you use other gems in MacRuby without trouble?

So the answer: Yes and no. :-)


It seems found a gotcha with macgem while using rvm.
If rvm is set to anything other then the system ruby (rvm use system)
when you run macgem its basically the same as running plan old gem and
will install to whichever rvm ruby you have selected.

Basically using macgem you could be installing into ruby 1.8.6, which
doesn't make a ton of sense.

Here are a few tests I ran, minus some non essential output.

Keep an eye on the gem install paths.

~$ rvm use 1.9.2
->  Using /Users/arron/.rvm/gems/ruby-1.9.2-p136

~$ ruby -v
->  ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]

~$ gem list -d
->  dispatch (0.0.1)
->    Installed at: /Users/arron/.rvm/gems/ruby-1.9.2-p136

~$ macgem list -d
->  dispatch (0.0.1)
->    Installed at: /Users/arron/.rvm/gems/ruby-1.9.2-p136

~$ rvm use system
->  Now using system ruby.

~$ ruby -v
->  ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

~$ gem list -d
->  n/a    # I don't have the dispatch gem installed for system ruby 1.8.7

~$ macgem list -d
->  dispatch (0.0.1)
->    Installed at:
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2


You can see the problem, in any rvm other then system, macgem is just
aliased to gem.

I just don't know if it's a problem, or me not understanding how things work.
And if it is indeed a problem I'm not sure if it's with rvm or macgem/macruby

Arron Mabrey


On Jan 7, 2011, at 2:47 PM, "Ernest N. Prabhakar, Ph.D."
<prabhaka at apple.com> wrote:

> Silly question, but are you using "macgem" to install it where MacRuby expects it? Can you use other gems in MacRuby without trouble?
>
> -- Ernie P.
>
>
> On Jan 7, 2011, at 10:24 AM, Arron Mabrey wrote:
>
>> I want to use the Dispatch gem in my MacRuby.app.
>>
>> https://github.com/gunn/Dispatch
>>
>> The gem is installed.
>>
>> However I'm having problems just requiring it.
>> # app_controller.rb
>> require 'rubygems'
>> require 'dispatch'
>>
>> Errors out with.
>> /Users/arron/code/MyApp/build/Debug/MyApp.app/Contents/Resources/rb_main.rb:18:in
>> `block': no such file to load -- dispatch (LoadError)
>>    from /Users/arron/code/MyApp/build/Debug/MyApp.app/Contents/Resources/rb_main.rb:16:in
>> `<main>'
>>
>> What are the proper steps to require a gem within a Xcode project? Is
>> it necessary to require rubygems?
>>
>> Also what are the proper steps to include the gem in the app to
>> resolve dependancies at deployment?
>>
>> Arron Mabrey
>> _______________________________________________
>> 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


More information about the MacRuby-devel mailing list