Trying to install curl with homebrew, getting “incompatible library version” for libcurl.4.dylib

curlhomebrewpath

I am on OSX 10.9.5. I would like to use a later version of CURL than what is bundled with OSX, but I do not want to remove the OSX binary just in case, so I wanted to opt to install it via homebrew.

my PATH:

$ echo $PATH
/Users/Tom/.nvm/v0.10.33/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/Tom/.composer/vendor/bin:/usr/local/mysql/bin::~/Library/Trigger\ Toolkit:/usr/local/heroku/bin

as you can see, /usr/local/bin is almost at the front of the path, behind my Node nvm path.

result of $ brew install curl:

Warning: curl-7.38.0 already installed

result of $ curl:

dyld: Library not loaded: /usr/local/lib/libcurl.4.dylib
  Referenced from: /usr/local/bin/curl
  Reason: Incompatible library version: curl requires version 8.0.0 or later, but libcurl.4.dylib provides version 7.0.0
[1]    6481 trace trap  curl

What did I do wrong with the installation? Why didn't brew include the required libcurl version?

Best Answer

One solution was provided here

The idea is to make a static build of curl and then paste it to you /usr/bin/ or /usr/local/bin/. Briefly:

  1. ~$ xcode-select --install
  2. Download the latest version of curl.
  3. cd to the directory and run

    ~$ ./configure --disable-shared --with-darwinssl --enable-threaded-resolver

    ~$ make -j `sysctl -n hw.logicalcpu_max`

  4. Copy the compiled curl, which is located in ./src/curl to you /usr/bin/

Note: In the make command in 3, the sign "`" is indeed back quote, not single quote.

Related Question