Adobe Acrobat 7 is a necessary evil for some operations such as OCR, rotating or deleting pages (although as an editor PDFPen is cheaper and more useable). Acrobat has grown into a sumo of an application, with incredibly sluggish load times. If you peek under the hood, you will notice it actually has a full copy of MySQL embedded in it. I am not fond of MySQL, but it is not that bad of a database as to account for all the bloat in Acrobat, who knows what else lurks in that package?

At any rate, Acrobat is to be used as a last resort, and most definitely not the viewer of choice. Apple’s own is far snappier and more pleasant to use (no annoying Yahoo toolbars or spurious JavaScript warnings when you have the good sense to disable a potential security hole). Acrobat insists on taking over ownership of a file once you save it, however. You could manually change the HFS creator code for each file by hand, but this is where Spotlight’s efficiently indexed metadata database shows synergy with OS X’s underlying UNIX scripting magic. The following one-liner will clear the creator code for all PDF files on your system so they open with Preview instead of Photoshop. It can easily be added to a crontab or launchd script.

mdfind ‘kMDItemCreator==“Adobe Acrobat*”’|tr “\012” “\0”|xargs -0 -n 1 /Developer/Tools/SetFile -c ‘’

If you simply want to strip the creator application from all PDF documents altogether, this script will do the trick:

mdfind ‘kMDItemKind=“Adobe PDF document” and kMDItemCreator!=""’|tr “\012” “\0”|xargs -0 -n 1 /Developer/Tools/SetFile -c ‘’

mdfind queries the Spotlight metadata for all files with a creator that starts with “Adobe Acrobat”. xargs reads arguments from standard input and passes them as command-line arguments to the SetFile utility (part of the OS X Developer Tools). tr replaces line feeds with ASCII 0 NUL characters used as argument separators when xargs is invoked with the -0 option, so embedded spaces in filenames are passed unscathed. I have tested this with Unicode file names, and they are handled correctly as well.

Thanks to Spotlight, the whole process takes only a couple of seconds on my machine, something that would not be possible if it had to scan through 300GB’s worth of files. It also goes to show that Spotlight’s apparent sluggishness when you use it from the GUI stems entirely from the overhead of the GUI struggling to progressively display search results as they are returned by the metadata index, not from the underlying database engine. There is no justification for Google searches of the entire Internet being faster than a local desktop search.

Of course, the technique can be generalized to other ownership changes for contested file formats like HTML, JPEG or TIFF.