If you're running into trouble when installing the ruby-filemagic gem on Mac OS X:
Installing ruby-filemagic (0.4.2) with native extensions /Users/bascht
/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/bascht/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb checking for magic_open() in -lmagic... no ***
ERROR: missing required library to compile this module
You might wanna hand over the path to your macports installation of file.
--with-magic-dir=/opt/local
Kudos to @Xylakant who stumbled over the correct way how to do this with bundler:
bundle config build.ruby-filemagic --with-magic-dir=/opt/local