A very old question, I'm aware, but searching for a solution I may have found a better answer.
The main problem with using "find" is that it relies on an attribute set to executable, even if this attribute is set for a non-executable file.
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.