I have a OSX 10.7 Lion with ruby 1.9 installed via macports:
sudo port install ruby19 +nosuffix +mactk
All works fine, if i run ‘ruby’ in terminal it runs Ruby version 1.9. But if i try to install ‘rb-cocoa’ to get Rubycocoa access in my macports ruby, i got following error:
sudo port install rb-cocoa
---> Computing dependencies for rb-cocoa
---> Installing ruby @1.8.7-p357_0+thread_hooks
---> Activating ruby @1.8.7-p357_0+thread_hooks
Error: Target org.macports.activate returned: Image error: /opt/local/bin/erb is being used by the active ruby19 port.
It seems that rb-cocoa ignores my Ruby 1.9 install and wants ancient 1.8 version :(. Is it any way to handle this error, or all this is not intended to be used on OSX?
Lion includes RubyCocoa for use with the system-provided Ruby 1.8.7. If you’re trying to get an existing RubyCocoa app to run, then you shouldn’t have to install Ruby or RubyCocoa at all.
Reasons to install RubyCocoa from MacPorts might include: satisfying MacPorts dependencies, using a newer/custom version of RubyCocoa, or installing on an older version of the OS that didn’t include RubyCocoa.
If MacPorts had a port of
rb-cocoathat was compatible withruby19, it would be calledrb19-cocoa. However, RubyCocoa doesn’t seem to support Ruby 1.9 at all.install.rbchecks for 1.9 and errors out.It sounds like MacRuby is a better solution for writing new Cocoa apps in Ruby, although I haven’t used it myself. But if you’re trying to run an existing app, by all means use 1.8.7.