代码之家  ›  专栏  ›  技术社区  ›  ShanZhengYang

如何在不进行迁移的情况下卸载MacPorts?

  •  0
  • ShanZhengYang  · 技术社区  · 6 年前

    我正在使用MacOS High Sierra 10.13.5。我想卸载我的MacBook上的MacPorts。

    根据这里的说明:

    https://guide.macports.org/chunked/installing.macports.uninstalling.html

    我应该做以下事情

    $ sudo port -fp uninstall installed
    

    以下是我看到的回应:

    Error: Current platform "darwin 17" does not match expected platform "darwin 16"
    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
    

    在卸载之前,我真的需要先进行迁移吗?现在有没有直接安装的方法?

    2 回复  |  直到 6 年前
        1
  •  1
  •   Ken Thomases    6 年前

    绝大多数macports安装的东西进入/opt/local。当然,您可以使用以下方法删除它:

    sudo rm -rf /opt/local
    

    我知道有几个端口可以将内容安装到/applications/macports中,所以您也可以这样做来捕获这些内容:

    sudo rm -rf /Applications/MacPorts
    

    我有一个端口在/library/launchdaemons中安装了启动守护程序,因此:

    sudo rm -rf /Library/LaunchDaemons/org.macports.*
    

    您可以检查类似的位置,如/library/launchagents和~/library中的相应目录。


    实际上,你在问题中提供的链接告诉你该怎么做:

    $ 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
    
        2
  •  2
  •   neverpanic    6 年前

    而绝大多数文件都安装在 /opt/local , /Applications/MacPorts /Library/LaunchDaemons/org.macports.* ,有几个端口可以在其他位置安装文件,例如,由于操作系统的要求。根据您是否安装了此类端口,Ken提供的解决方案( https://stackoverflow.com/a/50670316/2127896 )可能会留下一些文件。

    如果要确保捕获了所有文件,请按照 MacPorts migration instructions 在步骤3之前,即基本上重新安装MacPorts Base(例如通过运行安装程序)。这只需要几分钟。

    然后,跟着 https://guide.macports.org/#installing.macports.uninstalling ,即运行

    $ sudo port -fp uninstall installed
    

    然后 rm -rf 肯的回答中已经提到了命令。