Mac : Ports broken after El Capitan upgrade

By | November 2, 2015

Mostly as usual, MacPorts have issues after Mac OSX upgrade. In my particular case it was after upgrading from Yosemite 10.10 to El Capitan 10.11.

After issuing the following update command :

sudo port selfupdate

The following error showed up :

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

So I end up using the suggested command :

sudo port -v selfupdate

Then I have remarked the following :

checking whether the C compiler works… no
configure: error: in `/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base’:
configure: error: C compiler cannot create executables

This tell me something is wrong with Xcode, so let’s just use the following command to fix this matter :

sudo xcode-select --install

Then let’s try to upgrade the outdated packages :

sudo port upgrade outdated

Everything should be back to normal now.

NOTE : Down the road, if you cannot get the upgrade command working in the end and you’ve followed all these steps, you may try to upgrade the MacPort package directly by downloading the installer at https://www.macports.org/install.php