Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to find out which Application / package owns or creates a specific file? For example, in Linux these commands will show the package owner

apt-file /bin/progname

rpm -qf /bin/progname

yum whatprovides /bin/progname

In OS X, a file could be part of a native OS X application, or installed by Macports or Homebrew. These are completely different environments. Are there commands for each environment to check which application / package owns a specific file?

share|improve this question
up vote 8 down vote accepted

It's a little late, but perhaps it will be of help to others.

You can use the pkgutil command.

For example, if you want to know what package the "less" command belongs to run:

pkgutil --file-info /usr/bin/less

Which will output something like:

volume: /
path: /usr/bin/less

install-time: 1310407891
uid: 0
gid: 0
mode: 755

To list all files contained in a package, in our example, run:

pkgutil --files

I know this tool has been present since OS X 10.6.

share|improve this answer
This should be marked as the right answer. You can even use it with GUI applications. Try pkgutil --file-info /Applications/, and you'll get that it belongs to, but will also tell you which updaters have been applied to it (in my case,,, – juandesant Jan 19 at 13:04

This is not really possible since there's no standardized package management.

Unless you configured MacPorts or Homebrew differently, you'll always find their executables in a location that nobody else uses. Since MacPorts and Homebrew do not run under a separate user account, the files they create will always be owned by your user or root.

What's left is that you can only try to guess based on the executable location. Here are some rules:

  • MacPorts uses /opt/local/bin and /opt/local/sbin for executables, everything prefixed under /opt/local.

  • Homebrew uses /usr/local/bin for executables, everything else under /usr/local/.

  • Other applications should create their own directories somewhere under /usr, e.g. /usr/local/git/bin for the Git OS X installer or /usr/X11/bin for X11.

  • Some system frameworks symlink to /usr/bin, e.g. rake points to /System/Library/Frameworks/Ruby.framework

  • No application should ever use /bin or /sbin. No third party application (i.e. anything not an OS X framework) should use /usr/bin either.

share|improve this answer
It's not true there's no standardized package management. Mac OS X installs almost all software from packages (using the Installer) and keepsa record. See answer from @bhavin. – Neil Mayhew May 9 '15 at 21:35
You're right. I was more talking about the programs which might not use standard packages. Didn't know much about pkgutil when I wrote this answer. – slhck May 9 '15 at 21:40
I didn't know about pkgutil either, and it sounds pretty handy. – Neil Mayhew May 10 '15 at 19:04
With MacPorts, you can find out which port owns a particular file using port provides FILE – Neil Mayhew May 10 '15 at 19:06

You must log in to answer this question.

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