Ask Different is a question and answer site for power users of Apple hardware and software. 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

I'm writing a new formula for Homebrew for some software I maintain and as part of my testing I'd like to ensure that files are only added to the correct places on install and that all files are removed on uninstall.

What's the best way of going about comparing file structures before and after my test installs and uninstalls?

share|improve this question
Obviously not what you asked for, but still useful for a similar task is 'lsbom'. – Max Ried Feb 18 '12 at 8:24

In Terminal I can think of two choice:

  1. ls -R.

  2. tree directory-name/ (after you install it; i.e. brew install tree). The slash at the end preserves the display of special characters in the file the output is saved to.

In both case you redirect the output to a file before and after installation and compare the two files possibly using Apple shipped with Xcode.

share|improve this answer

I like using "find" and "shasum" for this sort of task. Two different invocations, 1 for the structure, and another for the sha-1's of the files:

find -s /path/to/directory -ls > files-before.txt
find -s /path/to/directory -type f -exec shasum \{} \+ >> files-before.txt

Run your installs/uninstalls, and then use the same process to "files-after.txt". Then

diff files-before.txt files-after.txt
share|improve this answer

Two ways occur to me off the top of my head:

  • fseventer is an app that uses Apple's FSEvents framework to watch the filesytem change live. Be sure to read the warnings and caveats on the developer's website.
  • Make a copy of the relevant directories (to someplace convenient, like your desktop) before performing the action. You can then use FileMerge (comes with the developer utilities) to compare directories.
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.