Death to .DS_Store

brian_d_foy on 2002-12-13T06:51:58

Mac OS X uses a .DS_Store file in directories to perform some sort of magic. I do not care what sort of magic as long as it does not get into my CVS repositories, Perl distributions, or anything else.

For instance, I recently downloaded a Perl distribution for CPAN Search. I just wanted to look at the distribution rather than install it. After looking at it in the Finder, I decided to install it. Since I had already looked at it in the Finder, Mac OS X silently created .DS_Store files. MakeMaker takes anything in lib and copies it into blib.

g4_brian[3136]$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Test::LongString
g4_brian[3137]$ make
cp lib/Test/LongString.pm blib/lib/Test/LongString.pm
cp lib/Test/.DS_Store blib/lib/Test/.DS_Store
cp lib/.DS_Store blib/lib/.DS_Store
Manifying blib/man3/Test::LongString.3


Things in blib get installed.

g4_brian[3139]$ make install
Installing /usr/local/lib/perl5/.DS_Store
Installing /usr/local/lib/perl5/Test/.DS_Store
Installing /usr/local/lib/perl5/Test/LongString.pm
Installing /usr/local/man/man3/Test::LongString.3
Writing /usr/local/lib/perl5/darwin/auto/Test/LongString/.packlist
Appending installation info to /usr/local/lib/perl5/darwin/perllocal.pod


Tonight I finally went to Google to see what this file does. Apparently it shows up in a lot of CVS repositories. I already knew that.

So, death to .DS_Store. In unix I go to foreign directories, meet interesting files, and delete them. Welcome my latest crontab command:

find / -name .DS_Store | xargs rm -f


Now I do not have to see these files no matter what I am doing.