MacPorts port selfupdate fail

Maybe I’m late to the party but when attempting to update my MacPorts installation recently I got an unusual error message: 

--->  Updating MacPorts base sources using rsync
MacPorts base version 2.1.1 installed,
MacPorts base version 2.1.2 downloaded.
---> Updating the ports tree
---> MacPorts base is outdated, installing new version 2.1.2
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

Error:/opt/local/bin/port: port selfupdate failed:Error installing new MacPorts base: command execution failed

MacPorts has been pretty rock solid for me so I knew it must be related to my OS upgrade or perhaps my Xcode 4.4 upgrade.  After a little digging I found that it was indeed related to Xcode and it turns out that the command line tools are not installed by default.  Perhaps Apple is conserving space here but it’s only 115 MB so …

A quick trip to the Xcode Preferences pane and then the Downloads tab will reveal that indeed the command line tools need to be installed.

​

After completing the installation MacPorts successfully upgraded itself.  Brilliant!

--->  Updating MacPorts base sources using rsync
MacPorts base version 2.1.1 installed,
MacPorts base version 2.1.2 downloaded.
---> Updating the ports tree
---> MacPorts base is outdated, installing new version 2.1.2
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl


The ports tree has been updated.