Skip to content

Instantly share code, notes, and snippets.

@eqhmcow
Created September 30, 2009 01:59
Show Gist options
  • Save eqhmcow/197635 to your computer and use it in GitHub Desktop.
Save eqhmcow/197635 to your computer and use it in GitHub Desktop.
This automates (more or less) the process described at http://trac.macports.org/wiki/Migration
#!/bin/bash
# This automates (more or less) the process described at http://trac.macports.org/wiki/Migration
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
port installed active | /usr/bin/perl -p -e 'undef $_ unless $b++; # the first line is info for humans
s/^\s*(.*)\s*\(active\).*/$1/; s/\s\@[^+\n]+//; # remove (active) and the version number
s/(\+[^+\n]+)/ $1/g' > active.macports # put spaces before each +
port clean --all all
port -f uninstall installed
# I'm sure there's a better way to do this, but it works...
IFS=$'\n'; /bin/cat active.macports | while read i; do /bin/bash -c "port install $i"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment