The Problem
If you’re starting rails server on Mountain Lion you might be encountering errors like these:
$ thin start >> Using rack adapter /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/lib/libltdl.7.dylib (LoadError) Referenced from: /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency' from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require' from /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/rmagick.rb:11 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler.rb:120:in `require' from config/application.rb:9 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' from config/environment.rb:2 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' from config.ru:3 from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' from config.ru:1:in `new' from config.ru:1
The Cause
Mountain Lion removes the /usr/lib/libltdl.7.dylib.
The Solution
1) Install XCode 4.4+ through the app store
2) Install the XCode Command Line Tools
XCode > Preferences > Downloads > Components
3) Make sure you have homebrew installed and run this:
brew uninstall imagemagick brew install --fresh imagemagick
4) Then to recompile the gem against the new version of imagemagick:
gem pristine rmagick
Follow me on Twitter: @pdenya