Determine MacPorts prefix

Ryan Schmidt ryandesign at macports.org
Wed Oct 10 02:18:00 UTC 2018



On Oct 4, 2018, at 19:22, Joshua Root wrote:
> On 2018-10-5 09:47 , Ryan Schmidt wrote:
>> Is there a simple command one can use at the command line to determine the MacPorts prefix?
>> 
>> `port prefix` came to mind as a logical thing to try, but it does not work.
> 
> dirname $(dirname $(which port))

Yeah I guess. It doesn't seem ideal. If MacPorts isn't installed, it prints two errors "usage: dirname path".

What prompted the question was that I found a build system that was checking for the existence of `port` in the path, and if found, hardcoding /opt/local paths into the build. I wanted to propose a change to the build system that determined the MacPorts prefix. I guess they could use your dirname solution.

Still, it might be nice to somehow be able to get MacPorts to print any given macports.conf setting. 



More information about the macports-dev mailing list