17

How can one find out the name of the port given a file name, more concretely an executable?

Macport website does not seem to help as you can only search by title and little more.

Thanks!

Valentin Ruano
  • 2,686
  • 17
  • 28
  • 1
    Which executable in particular are you looking for? Maybe I have it installed or know the port that contains it. – neverpanic Aug 23 '14 at 09:09
  • 1
    None in concrete... I found the one I was looking for eventually but this is the third time that I needed to know how to and I though should find out. – Valentin Ruano Aug 23 '14 at 15:33
  • related (the reverse): [Listing all files installed by some MacPorts package](https://apple.stackexchange.com/a/47547/6786) – michael Aug 06 '21 at 08:01

1 Answers1

27

Unfortunately MacPorts currently (2.3.1) only supports that if you have the port installed, i.e. if you want to find out which port installed a file on your system. In this case, you can use port provides </full/path/to/filename>.

If you are looking for a port to install using an executable name, you're out of luck – MacPorts doesn't have the required databases to do that.

What I usually do instead is search for the file in a Linux distribution, e.g. using apt-file search <filename> on Debian. Given the Debian package name, I search for a similar MacPorts port.

Stephen Rasku
  • 2,442
  • 3
  • 27
  • 48
neverpanic
  • 2,801
  • 16
  • 25
  • Sort of complementary information: there exists a program called `pkgutil` (at `/usr/sbin/pkgutil`) that prints information about files of macOS's own installed packages. `pkgutil` could possibly be used to find out how a file was installed. More details: https://superuser.com/a/891702/199930 – 0 _ May 30 '21 at 22:11