Update 2012: This material was written in 2006. Now, many years later, it still poisons the search engines with its presence. If you want to use Ruby and a package manager on OS X, you should use RVM and Homebrew. I will leave this page here as a warning to you, dear reader. Do not take detailed old technical Ruby recipes as advice.
Just had an exciting package management adventure with Ruby and XML on OS X. I wanted Libxml2 wrapped in a Ruby gem. So, I ran
sudo gem install libxml-ruby
…and watched the software fail to build. Darn OS X not “just being Linux”. After complaining to Christoffer, I was kindly pointed to a MacPort:
sudo port install rb-libxml2
OK, that worked. But I don’t want to use DarwinPorts/MacPorts for my Rubygems, the gems change far too often for that. What I wound up doing was reinstall my gem (sudo gem install libxml-ruby
), and then copy the libxml.bundle
to its folder:
# cp /usr/local/lib/ruby/gems/1.8/gems/xml/libxml.bundle \
/usr/local/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml/
Also, go into the file
/usr/local/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml/libxml.rb
and change the required file’s name from xml/libxml_so to xml/libxml.bundle.
This was enough to make the thing work!
Moral: The right way to fix this would be to enhance the Makefile of the libxml-ruby gem to teach it about the OS X environment, but: not me, not today. This little tip is what I can do today. Ciao.
The right way can most likely be discovered in the patch that DarwinPorts apply to the package. But I guess you already know that. Oh well, good night again.
Yes, interesting: the Portfile shows the name: extconf.rb.patch. Makes lots of sense, Chris.
Patch here, in Google’s cache.