Determining .app Executables From a Script

I’ve mentioned the codesign tool in previous articles, but today let’s look at a specific use. I recently needed to generate a report of the executable for around 2000 app bundles. Luckily, codesign displays the executable for an app when run with the –display option:

codesign --display /Applications/Utilities/Terminal.app

The output looks as follows:

Executable=/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal

Another tool that I haven’t written much about is productsign (also in /usr/sbin of Mac OS X 10.8). I’ll look at that one next, as a means of signing packages.