I'm trying to upgrade various programs I have installed with MacPorts. Unfortunately, python refuses to upgrade:

--->  Computing dependencies for python27
--->  Configuring python27
Error: Failed to configure python27, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.6/config.log
Error: org.macports.configure for port python27 returned: configure failure: command execution failed
Please see the log file for port python27 for details:
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:

The main.log file just has the output from ./configure, which isn't of any help, except it says that IPV6 support was not found. However, the config.log has this bit:

configure:11358: checking for getaddrinfo
configure:11376: /usr/bin/clang -o conftest -arch x86_64 -arch i386 -pipe -Os -fwrapv -arch x86_64 -arch i386 -I/opt/local/include -I/opt/local/include/db46 -arch x86_64 -arch i386 -isysroot / -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/db46 -arch x86_64 -arch i386 conftest.c -ldl  >&5
conftest.c:221:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
1 error generated.

The failed program is:

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>

main ()
getaddrinfo(NULL, NULL, NULL, NULL);
  return 0;

And this failed to compile because sys/types.h wasn't found, instead of getaddrinfo not existing. And when I pasted this program into a file, the C compiler succeeded in compiling it.

What is happening? What can I do about it?

1 Answer 1


Are you using a current version of MacPorts? They've been providing binary packages for quite some time now. I'd start by upgrading, then uninstalling python27 and then re-installing.

sudo port selfupdate
sudo port -f uninstall python27
sudo port clean python
sudo port install python
sudo port -uc upgrade outdated

I just did this on my install, and it installed the binary package, no compilation needed.

As to the actual error you're getting, I'd check that the XCode CLI tools are all installed; ls -lah /usr/include/sys/types.h should give you a file. If not, try xcode-select --install.

  • for some reason, my system doesn't have a /usr/include directory
    – tbodt
    Commented Feb 17, 2014 at 0:51
  • Make sure you've installed XCode, and then install the CLI tools by running xcode-select --install from Terminal.
    – miken32
    Commented Feb 17, 2014 at 0:56
  • are you sure it isn't different for Mavericks?
    – tbodt
    Commented Feb 17, 2014 at 0:58
  • Xcode finds the file just fine
    – tbodt
    Commented Feb 17, 2014 at 0:58
  • My Mavericks system has the standard C header files in /usr/include and many many more. I'm just guessing that these are installed as part of XCode and/or the command line tools.
    – miken32
    Commented Feb 17, 2014 at 1:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .