A common problem that I'm having with MacPorts is that I will go to install a port, and it will list a port as a dependency that I have installed outside of MacPorts.

For example:

I have Qt5 installed outside of MacPorts, and I absolute do not want MacPorts to install Qt4, but it is a dependency for the port I want. I want the port to use Qt5 libraries which I have installed in another location.

Also, I have Python 2.7.5 and Python 3 installed outside of MacPorts. However, when I go to install some ports that have Python as a dependancy, MacPorts tries to install port python27 — I do not want this port installed. I want to manage Python versions outside of MacPorts.

What are my options?


In general, MacPorts uses only a small collection of “system” libraries and tools; it really has no facility for using separately built libraries, tools, environments, etc.

See the entries titled “Why is MacPorts using its own libraries?” and “Will MacPorts link to system libraries rather than its own?” in the MacPorts FAQ.

You might be able to adjust individual Portfiles to use your already-built stuff, but you will really be working “against the grain” of the MacPorts system; you will likely run into many difficulties when undertaking such an approach.

It might prove easier to just manually build the software that you are ultimately interested in; that way you have better control over which libraries it uses. If there are a lot of (non-Qt, non-Python) dependencies, and if you do not mind building them through MacPorts, then you could still use MacPorts to provide other dependencies:

 # make sure the list of other dependencies looks reasonable
port echo depof:someport and not python27 and not qt4-mac

# install the other dependencies
sudo port install depof:someport and not python27 and not qt4-mac

# configure; the way to specify the library locations will vary, but might be like this:
CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib \
  ./configure --with-qt=/my/qt5/installation --with-python3=/my/python3/installation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .