On Jan 4, 2022, at 02:24, Mick wrote: > On Tue, Jan 04, 2022 at 08:56:43AM +0700, Michael Newman via macports-users > wrote: >> I'm using the -f option because I copied it from some recommendation I read >> somewhere. I'm not smart enough to figure things like this out myself so I >> usually rely on what I find by searching. For years I just ran: >> >> sudo port selfupdate >> sudo port upgrade outdated >> >> But then I read somewhere that to remove unneeded junk I should also run: >> >> sudo port -f clean --all all >> sudo port -f uninstall inactive >> sudo port uninstall leaves >> > What I usually do, is: > > sudo port selfupdate > sudo port -u upgrade outdated > > I read quite recently in the port documentation (man port) about the > usage of that "-u" option, which does exactly what you want, that is > removing inactive ports.
Note that the "-u" option has two different functions depending on what command you use it with. When used with upgrade (sudo port -u upgrade xxx), -u means uninstall the old version(s) of the port that's being upgraded (xxx). When used with uninstall (sudo port -u uninstall), -u means uninstall *all* inactive ports. I find this double meaning confusing and wish we would remove this second usage, since it can be achieved with the clearer "sudo port uninstall inactive". I proposed this removal ten years ago: https://trac.macports.org/ticket/33933
