Skip to main content

Complete re-install of MacPorts - Knowledgebase / Data processing and analysis software resources - ESO Operations Helpdesk

Complete re-install of MacPorts

Authors list

The official guide to migrating/updating MacPorts after a major macOS upgrade is described here:

    https://trac.macports.org/wiki/Migration

Alternatively the following represents a step-by-step guide to making a complete reinstall.

First make sure you are using the bash shell:

bash

The following command creates a list of all the packages you requested in your current installation, which you can use after re-installing the MacPorts system to re-install all those packages again. If you prefer to start over from a fresh MacPorts installation, you don't need to do this:

/opt/local/bin/port list requested | awk '{print $1}' | sort -u > $HOME/requested_ports.txt

The command above may fail depending on the “compatibility” of the “old” MacPorts installation under the new macOS installation, ideally it should be done before upgrading the OS.

Next do:

sudo chflags -R noschg,nouchg \
     /opt/local/ \
     /Applications/MacPorts
sudo rm -fr \
     /opt/local/ \
     /Applications/MacPorts \
     /Library/LaunchAgents/org.macports* \
     /Library/LaunchDaemons/org.macports.* \
     /Library/Java/JavaVirtualMachines/openjdk* \
     /Applications/DarwinPorts \
     /Library/Receipts/DarwinPorts*.pkg \
     /Library/Receipts/MacPorts*.pkg \
     /Library/StartupItems/DarwinPortsStartup \
     /Library/Tcl/darwinports1.0 \
     /Library/Tcl/macports1.0 \
     /Library/LaunchDaemons/org.freedesktop.dbus.*.plist \
     ~/.macports
rm ~/.macports

It may be necessary to remove /opt/local with the Finder.

Now reinstall with:

cd /tmp
OSname=$(sw_vers -productVersion | sed \
    -e 's/^15\..*/Sequoia/' \
    -e 's/^14\..*/Sonoma/' \
    -e 's/^13\..*/Ventura/' \
    -e 's/^12\..*/Monterey/' \
    -e 's/^11\..*/BigSur/' \
    -e 's/^10\.15\..*/Catalina/' \
    -e 's/^10\.14\..*/Mojave/' \
    -e 's/^10\.13\..*/HighSierra/' \
    -e 's/^10\.12\..*/Sierra/' \
    -e 's/^10\.11\..*/ElCapitan/' \
    -e 's/^10\.10\..*/Yosemite/' \
    -e 's/^10\.9\..*/Mavericks/' \
    -e 's/^10\.8\..*/MountainLion/' \
    -e 's/^10\.7\..*/Lion/' \
    -e 's/^10\.6\..*/SnowLeopard/' \
    -e 's/^10\.5\..*/Leopard/' \
    -e 's/^10\.4\..*/Tiger/' \
    -e 's/^10\.3\..*/Panther/' \
    -e 's/^10\.2\..*/Jaguar/' \
    -e 's/^10\.1\..*/Puma/' \
    -e 's/^10\.0\..*/Cheetah/' \
)

And then

MPpkg=$(curl -s https://api.github.com/repos/macports/macports-base/releases \
    | grep browser_download_url.\*${OSname}.pkg\" \
    | egrep -v '\-rc[0-9]*\-'\|'\-beta[0-9]*\-' \
    | head -n 1 | awk '{print $2}' | sed -e 's/"//g'\
)
curl -LO ${MPpkg}
sudo installer -pkg $(basename "${MPpkg}") -target /.
sudo /opt/local/bin/port selfupdate

Then to install the ESO MacPorts Repository:

curl -O ftp://ftp.eso.org/pub/dfs/pipelines/repositories/stable/macports/setup/Portfile
sudo /opt/local/bin/port install
sudo /opt/local/bin/port sync

Then to re-install all the packages you had before:

sudo /opt/local/bin/port install $(cat $HOME/requested_ports.txt)

 

Add a comment

Please log in or register to submit a comment.

Need a password reminder?