MacPorts curl not resolving localhost

Here’s an odd one I ran into tonight.

I had been using curl to debug some http REST code I’ve been working on, and recently it stopped working. I finally tracked it down to a version of curl that I installed as a dependency when I was playing with learning about git. Turns out, the macports version of curl that I installed (@7.17.0_0+darwin_8) simply didn’t want to recognize http://localhost:8080/ as valid, even though it was.

I was running a simple python WSGI server on that port. At first I thought maybe I was binding it funny – but heading to that address with Safari worked fine, I could telnet to localhost port 8080 and get a connect, and lsof was showing me that it was bound to a normal TCP socket. I’m still not sure what exactly was the issue, but when I manually invoked the system’s built-in curl (/usr/bin/curl instead of /opt/local/bin/curl), it finally worked.

To fully resolve this, I uninstalled git-core and curl from MacPorts, but that still seems really strange. I can only guess there’s some weird down-lower-level error that cropped up, but nothing was making it to the surface of the code. It just constantly refused to believe that localhost had port 8080 open. Worked fine for remote hosts.

Published by heckj

Developer, author, and life-long student. Writes online at

One thought on “MacPorts curl not resolving localhost

  1. How do you change what curl library is being invoked by apache? I am trying to use an updated curl lib than what is currently installed on my system.


Comments are closed.

%d bloggers like this: