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!
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.
port space --units MB installed
Nice and easy, has been available since version 2.0 all the way back in 2011!
Here's a small bash function that will take any valid macports query
function port_size {
size=0
pkg_size=0
for pkg in $(port $# | tail -n +2 | awk '{ print $1 }')
do
pkg_size=$(port contents $pkg \
| sed -r 's/^[[:space:]]*(.*)[[:space:]]*$/\1/g;s/ /\\ /g' \
| tail -n +2 | xargs du | cut -f1 | paste -sd '+' | bc)
size=$(( $size + $pkg_size ))
printf "%10d %s\n" $pkg_size $pkg
done
printf "%10d %s\n" $size "Total Size (KB)"
}
I've only tested it with GNU versions of sed and awk but it should work regardless.
port_size installed # will print out all installed packages and their size
port_size installed gcc* # will print out all packages matching gcc* wildcard
Again, any valid macports query will work (including installed inactive or outdated.

Related Links

Macports Selfupdate
How to recompile macport with additional ./configure flag?
Macport self update failed
Is it possible to use MacPorts to distribute custom software?
How do I make libgc work in Mac OS X?
500 OOPS: vsftpd: not configured for standalone, must be started from inetd
Mac Ports Update Failing
Macports ncurses error when trying to upgrade [closed]
macports: list out my own ports
why does macports “--set ipython ipython32” fail?
Prevent MacPorts from installing pre-built package?
Wine is extremely slow, how do I find out why?
Problems with macports
Where can I view tools or packages availble in Homebrew
See what has been installed via MacPorts
Installing a php extension with Macports

Categories

HOME
openshift
entity-framework
flask
user-interface
apache-nifi
shinyapps
facebook-messenger
seedstack
opencv-python
redmine
risk-management
portable-class-library
apache-kafka-connect
openfoam
u-boot
responsive-design
xades4j
game-maker
cname
powermock
nest-api
c#-7.0
web-deployment
user-defined-types
codefluent
infrared
pst
sybase-ase
exchange-server-2010
backendless
restier
ratio
jstree
php-5.3
bonita
tsung
ibm-connections
amazon-iam
objectmapper
xmlunit
gnu-classpath
wdk
macports
task-parallel-library
netapp
httphandler
jenkins-slave
intellij-lombok-plugin
hibernate-ogm
karabiner
redisson
simple-schema
gtk#
mobile-angular-ui
clrs
glimpse
msxml
openerp-6
ipywidgets
dojo-build
groovyfx
bbc-micro
android-syncadapter
wicked-pdf
node-glob
uibinder
timestamping
verisign
polymerfire
voronoi
gdl
netdatacontractserializer
css-paged-media
blockquote
supercomputers
camus
fasterxml
famo.us
juttle
jquery-mobile-flipswitch
reference-counting
meteor-collections
webaii
spring-social-linkedin
notifyjs
ember-table
bcdedit
eager-loading
office-app
red-system
xalan
live-wallpaper
kaazing
firebird1.5
gwt-celltable
haiku
groovy-console
digiflow
printqueue
aptitude
ios-4.2
cassini
source-code-protection
wmd-editor
prism-2

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App