Skip to content

Instantly share code, notes, and snippets.

@huwr
Last active December 21, 2015 22:09
Show Gist options
  • Save huwr/6373219 to your computer and use it in GitHub Desktop.
Save huwr/6373219 to your computer and use it in GitHub Desktop.
Cleans away old Mac Ports
#!/bin/bash -v
#
# clean old mac ports. Can save a few GBs.
# run as root.
echo "Before: "
du -sh /opt
dupes=$(port installed | cut -d '@' -f 1 | uniq -d)
if [ -z "$dupes" ]
then
echo "No duplicates."
else
echo `echo $dupes | wc -l` " duplicates"
echo $dupes
fi
port clean --all installed
port -f uninstall inactive
port uninstall leaves
echo "After:"
du -sh /opt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment