Macports: Current platform "darwin 16" does not match expected platform "darwin 15"

root's picture

You have upgraded to macOS Sierra and found this error while trying to upgrade macports via command line?

fmbp:~ root# port -v selfupdate
Error: Current platform "darwin 16" does not match expected platform "darwin 15"
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

The error is explaining very well what is happening and the recommendation is to visit the Migration website for further instructions.
My recommendation (and tested of course) is to just download the latest macports, the Sierra version and install it.

However,

as normal, after the macports installation you have to upgrade the packages and sometimes you can get compile errors. If this is the case for you, follow the migration instructions.

In short, you have to do the following:

fmbp:~ root# port -qv installed > myports.txt
fmbp:~ root# port echo requested | cut -d ' ' -f 1 > requested.txt
fmbp:~ root# port -f uninstall installed
fmbp:~ root# port selfupdate
fmbp:~ root# port clean all
fmbp:~ root# curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
fmbp:~ root# chmod +x restore_ports.tcl
fmbp:~ root# ./restore_ports.tcl myports.txt

Cheers!

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root