Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

macports

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

like image 441
Hailiang Zhang Avatar asked Dec 11 '22 15:12

Hailiang Zhang


2 Answers

port space --units MB installed

Nice and easy, has been available since version 2.0 all the way back in 2011!

like image 126
miken32 Avatar answered Jan 13 '23 13:01

miken32


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.

like image 43
Alec Avatar answered Jan 13 '23 15:01

Alec