Port install never uses packages, always compiles from source - why?

Ryan Schmidt ryandesign at macports.org
Sat Apr 11 08:16:09 UTC 2020

On Apr 11, 2020, at 02:02, Lothar Haeger wrote:

>> The prebuilt ports on the buildbot are not building their ports to go into /Applications, so therefore they don’t match your setup — so you can’t use them (even though many would be OK, it’s an all-or-nothing thing.
> Ok, so what if I want to change back to the default and set "applications_dir" to "/applications/MacPorts"? Will this break the already installed ports somehow? Would I have to move them manually to the default location? Or uninstall and reinstall them? Or would that only affect new installs and updates?

If you change a setting in macports.conf, you should uninstall and reinstall any ports affected by that setting.

In this case, you should uninstall and reinstall any MacPorts ports that installed anything in /Applications.

If MacPorts warns you that uninstalling a port will break another port, it's fine to bypass that warning using the -f flag in this case, since you'll be reinstalling the port after uninstalling it and thus fixing any breakage.

Since /Applications also contains apps not installed by MacPorts it's not as simple as just looking into that folder in the Finder, but you can get a list of ports like this:

port -q contents active | sed -n -E 's,^[[:space:]]*(/Applications/),\1,p' | tr '\n' '\0' | xargs -0 port -q provides | sort -u | tee ports-that-install-apps.txt

This will show you all the ports that install applications, but it is also possible for a port to use an application installed by another port. The list produced by the following commands should include those ports:

port -p file active | sort -u | xargs grep -El '\${?applications_dir' | sed -E 's,^.*/([^/]+)/Portfile$,\1,' | sort -u | tee ports-that-use-apps.txt

To combine the two lists into one:

cat ports-that-install-apps.txt ports-that-use-apps.txt | sort -u | tee ports-that-install-or-use-apps.txt

To uninstall those ports:

xargs < ports-that-install-or-use-apps.txt sudo port -f uninstall

To reinstall them:

xargs < ports-that-install-or-use-apps.txt sudo port install

More information about the macports-users mailing list