Preventing MacPorts from installing things I already have
How do I prevent MacPorts from installing dependencies that already exist on my machine? For example, it tries to install Python when it's already available on my machine. (Why does it try to install its own copy?)
I suppose I could write a script that parses the output of port rdeps {package}
and checks each dependency against my current setup. I'm actually hoping for something simpler, such as a magic flag or an environment variable.
MacPorts deliberately installs software that is also present on the Mac. This is done to ensure the installation is stand-alone, and that changes to the core OS don't interfere. This is, generally, a good policy, although not a universal one.
There is no feature to do what you want; you could manually exclude everything, but that would also run into the problem that you now have unsatisfied dependencies and can't install any port that depends on, eg, Python.
If you want to use the model of using system dependencies, homebrew is the tool you want. Unlike MacPorts, it has a deliberate design and policy that is does use system dependencies.