Mac – Can’t update MacPorts after upgrading to Mavericks

macports

I ran port selfupdate and MacPorts tried to upgrade itself to version 2.2.1, but eventually fails. When I add the -v flag, I can see the build fails after these lines:

checking for Tcl configuration... configure: error: Can't find Tcl configuration definitions
Command failed: cd     /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base && CC=/usr/bin/cc OBJC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make SELFUPDATING=1 && make install SELFUPDATING=1
Exit code: 1

How can I get MacPorts back?

Best Answer

You need to update the command line tools Xcode installs. For whatever reason, Xcode doesn't seem to want to update them itself, but you can force it by running xcode-select --install. This will pop open a GUI prompt; select "Install" and let the installer do its thing. After this, MacPorts should build itself successfully. (You may need to rehash first; rehash in tcsh, hash -r in bash and zsh (I think).)