Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 2 down vote accepted

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 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 at 21:40
I didn't know about pkgutil either, and it sounds pretty handy. –  Neil Mayhew May 10 at 19:04
With MacPorts, you can find out which port owns a particular file using port provides FILE –  Neil Mayhew May 10 at 19:06

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

pkgid: com.apple.pkg.BaseSystemBinaries
install-time: 1310407891
uid: 0
gid: 0
mode: 755

To list all files contained in a package, com.apple.pkg.BaseSystemBinaries in our example, run:

pkgutil --files com.apple.pkg.BaseSystemBinaries

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.