Search code examples
macports

How to get the size of the installed package via MacPort?


port installed displays all the installed packages on the local machine, but is there any way to list the size of each one? Thanks!


Solution

  • I don't believe there's a build in command from Macports to list the size of your installs, but you can do this:

    Try this command in the terminal:

    du -sh /opt/local/var/macports/software/*
    

    This will give you the size of every package in /opt/local/var/macports/software/*, which I believe is the default install location.

    Obviously, if you install your ports somewhere else you can use

     du -sh [directory]
    

    Without a built in Macports command, this is the probably the best you can do.

    One alternative that comes to mind is creating a script that would take the output of

     port installed
    

    and echo the size of each install.

    edit:

    I was mistaken. /opt/local/var/macports/software/* contains the tarbells that the installations were extracted from, so the sizes will be smaller.

    If you do du -sh /opt/local, it should list the size of everything, but there may be a few non-macports packages in the list.

    The command port contents installed will show you the directory of everything macports has installed.