0

I just started using MacRuby for a simple Mac Application, and I now have a problem.

For my project I use the rmagick gem.
I installed it as described with the command

sudo macgem install rmagick

Everything worked well, but the problem is that if I try to load it in my AppDelegate.rb file with require 'rmagick'. I get an error saying that there is no such file to load.

This is strange, because I noticed that if I first build the project normally and then build the deployment target, I'm able to execute the application without any problems.

It would be really cool if there would be a way to use the gem in the development target, because otherwise I need 30 seconds after each change I made which in total is really much xD

evotopid
  • 5,288
  • 2
  • 26
  • 41

1 Answers1

4

Yeah RMagick can be a tricky one:

require 'rubygems'
require 'RMagick'

is the answer. Also macruby apparently still requires the require 'rubygems'. But beware, the module you actually will be using is called Magick.

A short example:

require 'rubygems'
require 'RMagick'
image = Magick::Image.new "path/to/image.png"

Here you will find the RMagick-documentation.

robustus
  • 3,626
  • 1
  • 26
  • 24
  • Thanks, the problem was that I forgot the `require "rubygems"`. Somehow it seems for me that requires are case insensitive because it works with `rmagick` and `RMagick` – evotopid Aug 13 '12 at 21:57