My Xcode build requires cURL 8.0.0 or later (which doesn’t exist)

homebrewxcode

I'm writing a C program in Xcode that uses cURL. It builds properly on my Mac Pro running 10.8.5, but on my MacBook Pro running 10.8.5, it gives me this error when I try to build:

dyld: Library not loaded: /usr/local/opt/curl/lib/libcurl.4.dylib
  Referenced from: /Users/AlecZ/Library/Developer/Xcode/DerivedData/UPServer2-folctfcnmdhllzbddscwimqrggig/Build/Products/Debug/UPServer2
  Reason: Incompatible library version: UPServer2 requires version 8.0.0 or later, but libcurl.4.dylib provides version 7.0.0

The latest cURL is 7.37.0, so I don't see how it could require 8.0.0. I have run into similar issues before when trying to compile software for Linux from its source, the compiler stating that I need a nonexistent version of some library.

I have already run brew install libcurl, but it says that I can't replace the system library for cURL.

Best Answer

Try reinstalling curl package, e.g.

brew update
brew reinstall curl libcurl

This should fix the broken dependencies.

If this won't help, then try to comment out or remove any DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or DYLD_FRAMEWORK_PATH references from the startup shell scripts (e.g. ~/.bash_profile).