I don't know how to explain it well (:P), the script finds which packages are not needed by others, so you can delete those you don't use.
It's my first shell script, so feedback is apreciated, :) This is in public domain, blah blah blah blah. #!/bin/ksh function check_for_packages { for package in $(pkg_info | cut -f 1 -d \ ); { echo "Checking if any package depends on $package" if ! pkg_info -R $package | fgrep -q 'Required by:'; then tput up dl 0 echo "No package depends on $package, would you like to delete it? YES/n" while :; do read answer tput up dl 0 case $answer in YES ) sudo pkg_delete $package break ;; n ) break ;; * ) echo 'YES/n' ;; esac done else tput up dl 0 fi } } check_for_packages