MacPorts “selfupdate” error on OS X Mavericks

Recently I tried to update macports and got error:

$ sudo port install MySQL
...
Error: Error installing new MacPorts base: command execution failed
Please run `port -v selfupdate' for details.
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed

The fix is:

$ sudo xcode-select --install

Result:

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated

Installation of Midnight Commander on MacOS 10.8.3

Today I needed to install MC on my Mac.
So that is step-by-step guide:

– Installed MacPorts
Downloaded last version pkg from here http://www.macports.org/install.php and installed it

Then I tried to install MC (sudo port install mc) but got error:

Warning: The Command Line Tools for Xcode don’t appear to be installed; most ports will likely fail to build.

Continue reading