MacOS – How to compare file structures before and after a software install

homebrewmacossnow leoparduti

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?

Best Answer

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 FileMerge.app shipped with Xcode.