<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>clog: Tag GD2</title>
    <link>http://blog.chrispcritter.com/articles/tag/gd2</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Getting Ruby GD2 working on OSX</title>
      <description>I installed the Ruby GD2 gem on my Mac last night and found myself getting the following error:
&lt;br /&gt;&lt;br /&gt;

ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:59:in `initialize&amp;#8217;:RuntimeError: dlopen(libgd.2.dylib, 9): image not found
&lt;br /&gt;&lt;br /&gt;

It didn&amp;#8217;t take very long to figure out that OSX doesn&amp;#8217;t seem to come with any version of libgd.  After bouncing around with trying to get RMagick installed instead, and finding very little documentation on setting up the Ruby GD2 library, I decided to install the gd2 package via ports and reinstalled the gem with the same results.  It still wasn&amp;#8217;t finding libgd because the ports library path (/opt/local/lib) is not set in my path.  I don&amp;#8217;t set this because I want anything self-compiled to only use the Mac libraries.  After some digging, I found that I could  specify the path in the Ruby GD2 source.  
&lt;br /&gt;&lt;br /&gt;

To fix it I changed line 33 in &amp;#8220;ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb&amp;#8221; from:
&lt;br /&gt;&lt;br /&gt;
case Config::CONFIG[&amp;#8216;arch&amp;#8217;]&lt;br /&gt;
   when /darwin/&lt;br /&gt;
      &amp;#8216;libgd.2.dylib&amp;#8217;&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;&lt;br /&gt;

case Config::CONFIG[&amp;#8216;arch&amp;#8217;]&lt;br /&gt;
  when /darwin/&lt;br /&gt;
    &amp;#8216;/opt/local/lib/libgd.2.dylib&amp;#8217;&lt;br /&gt;&lt;br /&gt;

It&amp;#8217;s not the cleanest fix, but it&amp;#8217;s good enough for development purposes.  Hopefully this saves a few people from some of the circles I went through figuring this out.  It does seem that this is a least a more simple fix than what&amp;#8217;s required to get the RMagick library running on OSX. 

</description>
      <pubDate>Sun, 26 Nov 2006 12:05:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:c53372e1-955e-4027-8104-3f3bd3dc0ca8</guid>
      <author>chrisp</author>
      <link>http://blog.chrispcritter.com/articles/2006/11/26/getting-ruby-gd2-working-on-osx</link>
      <category>Development</category>
      <category>Ruby and RubyOnRails</category>
      <category>Ruby</category>
      <category>OSX</category>
      <category>Mac</category>
      <category>GD2</category>
    </item>
  </channel>
</rss>
