unmac -- Delete spurious Mac files under a directory or volume
unmac [OPTIONS] directory ...
-h, --help Print this help
-v, --verbose Show processing
-p, --pretend Show what would be deleted, but don't do it
-s, --keep-spotlight Do not delete Spotlight data
-f, --keep-fsevents Do not delete Time Machine stuff
-t, --keep-trashes Do not delete volume trashes
-m, --keep-macosx Do not delete "__MACOSX" directories
-r, --keep-dsstore Do not delete ".DS_Store" files
-d, --keep-apple-double Do not delete "._*" ghost files
-o, --keep-apple-double-orphans Delete "._foo.txt" only if "foo.txt" exists
-i, --keep-custom-folder-icons Do not delete custom folder icons
When a Mac copies files to volumes that have a different file system it adds
some auxiliary files that represent different kinds of metadata. This typically
happens with memory sticks, network drives, SD cards, etc. Mac archivers like
zip(1) add special files as well, like "__MACOSX", you'll see them for example
if you extract a Zip file like that on Windows.
The purpose of these special files is to let another Mac rebuild the metadata
from them, Spotlight integration, etc. But if you are not interested in these
features your directory or volume just gets cluttered. This utility removes
all those extra files.
This is just a summary, for more detailed explanations and pointers see the
comments in unmacer.rb:
* Spotlight leaves a folder called ".Spotlight-V100" in the root directory
* Time Machine relies on a folder called ".fseventsd" in the root directory
* A folder called ".Trashes" in the root directory of volumes stores their
trashes. Those ones are taken into account by the Trash in the Dock.
* Some archivers create auxiliary directories called "__MACOSX".
* Finder and Spotlight data related to each folder gets stored in an
extra file called ".DS_Store".
* For each file "foo.txt", its resource fork and some additional stuff
are stored in an accompaining ghost file called "._foo.txt". The pattern
is to prepend "._" to the original file name.
* If a folder has a custom icon you get a file "Icon^M" (that ^M is a hard CR).
Some stuff is only found in the root folder of volumes, unmac looks for them
in any directory you pass as argument, but not on their subdirectories.
This program is portable, it has been tested on Mac OS X, Linux, and Windows.
Should work at least in any other Unix.
unmac is distributed as a Ruby gem. Once you have Ruby and RubyGems installed
gem install unmac
See the MIT-LICENSE file included in the distribution.
Copyright (C) 2009 Xavier Noria.