libcurl missing libaries after switching from MacPorts to Homebrew

2.2k views Asked by At

I removed Macports a while ago so now I use Homebrew. Now I am trying to use the typhoeus ruby gem wich depends on multicurl.

When I try to execute my rubyscript I get the following Error-Message:

/Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'libcurl': dlopen(libcurl, 10): image not found. (LoadError) Could not open library 'libcurl.dylib': dlopen(libcurl.dylib, 10): Library not loaded: /opt/local/lib/libidn.11.dylib   Referenced from: /usr/local/lib/libcurl.dylib   Reason: image not found   from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'     from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'     from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:405:in `<module:Curl>'    from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:6:in `<module:Typhoeus>'  from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:5:in `<top (required)>'   from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'  from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'  from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus.rb:5:in `<top (required)>'    from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'  from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'    from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'  from app.rb:3:in `<main>'

Obviously some files are missing.

When I execute $ otool -L /usr/local/bin/curl I get:

/usr/local/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/lib/libidn.11.dylib (compatibility version 18.0.0, current version 18.5.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)

The issue here is that my folder /opt/local/ doesn't even exist.

  • How do i fix the missing links?
  • Where do I get the missing files? (libidn.11.dylib, libintl.8.dylib, libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and libz.1.dylib)?

Additional Infos:

  • I am using ruby 1.9.3 and Mac OSX 10.8
1

There are 1 answers

3
Jacob Gillespie On BEST ANSWER

It sounds like you have not fully removed MacPorts and its curl.

If you haven't already, you will want to follow the guide at http://guide.macports.org/chunked/installing.macports.uninstalling.html, specifically the following:

$ sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

After that, you will want to remove curl with sudo rm /usr/local/bin/curl.

curl and libcurl are already included on OS X, but /usr/local/bin is in your PATH before /usr/bin. So, at some point you probably installed a new version of curl with MacPorts that is now left over.

You will thus want to fully purge the curl stuff in /usr/local. That may end up being a little tricky, and if you don't have a lot installed with Homebrew, it might be a good idea to fully purge Homebrew and manually clean /usr/local before reinstalling Homebrew.

Finally, once curl is gone, you will want to remove the gems that were depending on libcurl and reinstall.

All this could have probably been avoided if curl was uninstalled with MacPorts before uninstalling MacPorts, but I've never used MacPorts myself, so not 100% on that.