Skip to content

Instantly share code, notes, and snippets.

@guziy
Created February 6, 2016 15:48
Show Gist options
  • Save guziy/ddc849ef1a65a784eddb to your computer and use it in GitHub Desktop.
Save guziy/ddc849ef1a65a784eddb to your computer and use it in GitHub Desktop.
#! /bin/bash
# exit on error
set -e
the_list=($( port installed | grep -v active | grep -v : ))
size=${#the_list[@]}
let size=$size-1
echo $size
for ((i=0; i < size; i+=2))
do
sudo port uninstall ${the_list[i]} ${the_list[i+1]}
done
@guziy
Copy link
Author

guziy commented Feb 6, 2016

Sometimes it has to be executed several times (removing set -e), since it is not smart enough to uninstall dependant before the dependencies)). Or mannually delete the dependents and restart the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment