This readme is a mixture of everything I read on SO+nokogiri wiki, which ultimately worked out for me.
Here are the steps which worked for me to get rid of segfaults with Nokogiri 1.4.4, on both Lion and Snow Leopard, with Ruby 1.8.7 (patchlevel 334 and +).
First diagnose which version of libxml2 you're using:
bundle exec nokogiri -v
If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this: