Upgrading MacPorts with port reinstallation

From blinkenwiki

  1. Install Xcode 8 and command-line tools. To install command-line tools:
    # code-select —install
  2. Download and install the MacPorts installer for Sierra.
  3. Get a list of the installed ports
    # port -qv installed > ports-2016.10.15.out
    
  4. Force a clean install (not necessary, according to the MacPorts migration page, but doing it anyway):
    # sudo rm -rf /opt/localsudo rm -rf /Applications/MacPortsReinstall MacPorts packagesudo rm /Library/LaunchDaemons/org.macports.slapd.plist
  5. Reinstall ports
    # chmod +x ./restore_ports.tclcurl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tclsudo ./restore_ports.tcl ports-2016.10.15.out

    (From Evernote)