I was looking for a way to determine if a file was an executable or not.
I did find quite a few answers, all seemingly relying on the find command line tool.
Unfortunately this would not work in a reliable way for me, since find relies on an attribute set to executable, even if this attribute is set for a non-executable file.
The fix: MacOS comes with a handy little command-line tool "`file`", which displays file information, for example:
$> file *
Distribution: directory
SomeFile.icns: Mac OS X icon, 3272878 bytes, "ic09" type
MyPicture.png: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
NSHelpers.pas: Algol 68 source text, ASCII text
myProgram: Mach-O 64-bit executable x86_64
As you can see, 'MyProgram' is an executable, and nicely indicated as such.
Since old 32bit executables will have the phrase "executable" in this as well, the following should list all true executable (binaries):
file * | grep "executable"
Hope this will be useful to somebody looking for an answer to the same question as well.
Note: `file` does not seem to have a function to recurse through subdirectories.