OS X (Lion) .DS_Store disabling
May 17Because we show hidden files in finder, primarily for the reason of being able to see/edit profile settings, git, and htaccess files, a problem that has just been silently bothering me for years has just reached a fever pitch as I’m trying to finalize a directory structure to upload. Sure, most programs worth their salt have an option to ignore files to upload/sync but it goes deeper than this – I JUST DON’T WANT THEM THERE.
I think anyone who argues about the utility of controlling files that are silently placed/replaced in potentially sensitive dirs (i.e. source code) doesn’t have enough experience to provide an opinion, even windows gives you the option to disable thumbnail caching (thumbs.db). The argument of “This is the way apple did it, therefore, obviously it’s a good design, you’re the one doing it wrong” is lacking substance.
In searching for potential solutions to disable the creation of .DS_Store files in EVERY. SINGLE. DIR. I offer the following solutions.
Cleanup
This will recursively clean up the offending files within whatever directory you point it. In Terminal (/Applications/Utilities/Terminal.app) – you may have to sudo depending on your target directory.
cd /Volumes/Dev [change to whatever dir you want to clean] find . -name '*.DS_Store' -type f -delete |
Solution #1: Brute Force
After having deleted the .DS_STORE files, I came across this solution and have been running it with success on Lion http://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/ it does a live patch on Finder to simply replace the function responsible for creating these files thus they simply Won’t be created. It includes a Launchd agent for setting this up at every reboot (Finder is not physically modified). This method completely disables Finder’s ability to remember view settings on folders that don’t already have them such as which view mode – Icon/Column/List, Window Size, Sorting, etc. are customized.
Solution #2: Redirection
Asepsis by BinaryAge (maker of TotalFinder and TotalTerminal – my fave) http://asepsis.binaryage.com/ is a cleaner solution in that it preserves the expected functionality which is ideal. Only drawback is it seems to break on every OS X version update. The author is very diligent however so it usually stays current.
While the first solution simply disables .DS_Store creation altogether – which will have the effect of folders not remembering their setting – this solution, re-routes the process of .DS_Store creation to a unified cache directory for all folders (rather than storing it in each one) hence maintaining the correct functionality while keeping everything clean.
Other Solutions
Cleanup on External drives: http://www.zeroonetwenty.com/blueharvest4/ (not free) provides an easy way to clean up external drives so they may be shared on other systems without showing evidence of their having been used on a mac (i.e. .Trashes, .FSEvent stores, Spotlight stores, etc.)
Prevention on Network Shares: (Apple KB)
defaults write com.apple.desktopservices DSDontWriteNetworkStores true |
Thanks to http://danilo.ariadoss.com/how-to-recursively-remove-ds_store-files-on-mac-os-x/ and many others for the cleanup step
For more info http://en.wikipedia.org/wiki/.ds_store
