Sometimes you may need to remove packages to make some place in your hard drive. The first thing you could try is to
# pkg_delete -ac
That should remove unused dependencies and extra configuration files, so that you will win some space.
A way to display the size of packages in MB from the smallest to the largest is
$ cat bin/pkg_size #!/bin/sh pkg_info -sa | paste - - - - | sort -n -k 5 | awk '{ $NF=$NF/1024/1024 ; print }'
If this is not enough, then run the following to have a look at what packages are the biggest in your installation
$ pkg_info -as | sed ':a;N;/\nInformation/!s/\n/ /;ta;P;D' | sort -k 5 > InstalledPackSize.txt
What sed is doing here is the following:
:a # Label to jump to
N # Append next line to pattern space
/\nInformation/!s/\n/ / # If the newline is NOT followed by "Information",
# append the line by replacing the newline with a space
ta # If we changed something, jump to label
P # Print part until newline
D # Delete part until newline
and then decide what you want to remove.