Do you have any pointer on how to write a script that will search my system for applications, libraries (i.e. /usr/local/lib and /usr/local), and binaries that are PPC only?
I upgraded my system from a PPC Mac to a Intel Mac running Leopard 10.5. Then I upgraded to Snow Leopard 10.6 which doesn't come with Rosetta. So I'm only now realising all the old PPC things that are left on my system!
Best Answer
The
file
command can detect what binary types are available in a file.So, then, it is just a matter of using find and filtering appropriately. Something like this should find all binaries on the system that have a PPC subsection.
PPC only is a little more difficult. For that, you'll want to do three commands to create 2 files in /tmp, the first containing a list of PPC files and the second a list of 32 or 64 bit x86 files. Conveniently, 'ppc' matches ppc and ppc64.
Then, sort/uniq a bit (just sorts the paths and makes sure each binary is only listed once):
Then, use diff (and a bit more processing) to spew the list of files that are ppc only:
The end result should be a list of files that only contain ppc executable mach-o sections. I would suggest verifying the list before nuking anything.
Some notes:
All of the above is done in the Terminal.
This is just a hack; it worked just fine on my system and I'm glad you asked because I wanted to know the same. But it is just a hack.