在 El Capitan 上卸载 MacPorts 时出错

Errors upon uninstalling MacPorts on El Capitan

我有一个 mac,我购买时安装了 Mavericks,现在升级了 El Capitan。我之前安装了 MacPorts,现在我想卸载,但出现此错误。

 > sudo port -fp uninstall installed

  Error: Current platform "darwin 15" does not match expected platform "darwin 13"

  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

macports迁移页面的卸载指令也是同样的错误。如果有人能解释错误就太好了。

MacPorts Guide Chapter 2.4. Uninstall:

To remove all remaining traces of MacPorts, run the following command in the Terminal. [...]

sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

编辑:哦,解释错误。您之前的 MacPorts 安装是针对 OSX 的早期版本,对应于 'platform "darwin 13"',但您现在 运行 是 OSX 的较新版本,对应于 'platform "darwin 15"'。

按照 http://trac.macports.org/wiki/Migration 处迁移说明的前两个步骤进行操作,然后继续正常卸载:

  1. Install the latest version of Xcode and the Xcode command line tools

    After a major system change, update the development tools by ​installing the latest version of Xcode. Open the Xcode application once after installation and follow any prompts. Install the command line tools package as well.

  2. Reinstall MacPorts base

    After updating the development tools, install the base MacPorts system for your new platform, either from the appropriate installer or from source.

    [...]