How to Prevent .DS_Store File Creation

Feb 3, 2010 - 10 Comments

.DS_Store files store folder level metadata information (such as icon placement and background pictures) for Mac OS X to understand, this is fine and dandy and you’re likely to never even notice if you’re a bunch of Macs working together. Unfortunately, these .DS_Store files can be really pesky in a multi-platform network environment, they can basically just lead to unnecessary filesystem clutter that Windows & Linux users receive no benefit from.

Thankfully, you can prevent the DS_Store files from being created entirely by executing a simple command in the Terminal.

To disable the creation of .ds_store files, launch the Terminal application from /Applications/Utilities/ and enter the following command string exactly:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Reboot the Mac for changes to take full effect (some report that killing the Finder is sufficient, but your mileage may vary).

This disables the creation of .DS_Store files for the user account the command was executed on. You can make this change to all user accounts manually by executing the same command under their login, or you can copy modified com.apple.desktopservices.plist file to the ~/Library/Preferences folder of each other user account.

Of course it’s not just Mac OS X that create files that are obnoxious for cross-platformers. The Windows equivalent to the DS_Store file is Thumbs.db, and if you’re a Mac in a largely Windows network, you’ll probably be running into these all the time. You can easily delete Thumbs.db files in Mac OS X by using Spotlight.

To re-enable the creation of .ds_store files, simply change the ‘true’ to ‘false’ in the defaults command string:

defaults write com.apple.desktopservices DSDontWriteNetworkStores false

You will want to reboot the Mac and reconnect network shares for the changes to take full effect.

This works in all versions of OS X, from OS X Mavericks to Mac OS X Snow Leopard. You can learn more about DS_Store files here.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Manish Patel in Mac OS X, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. Luke Z says:

    This only disables their creation on network drives. Not entirely.

  2. Gaurav Jain says:

    Yeah, one of the most problematic occurrences of this for my is on USB flash drives. There is program called BlueHarvest that does a good job of deleting these .DS_Store files as well as other metadata files. It’s available at:

    http://www.zeroonetwenty.com/blueharvest/

  3. Blair says:

    Snow Leopard users beware! (10.6.2) I had previously activated this setting which prevent .ds_store files from being created on my work network and it caused my system to crash and the finder to lock up and hang. This occurred whenever I tried deleting files or folders (even if the folder was empty) when connected to our network — using the Samba (SMB) protocol and Windows Small Business Server 2003.

    • nick says:

      how did you resolve this…
      on restart after activating this, my finder froze and now I cannot even boot up from a disc to reinstall the OS!

      kinda at a loss to what to do…

  4. Blair says:

    Addendum to my previous post: I anticipate this being fixed in the 10.6.3 release.

    See the 10.6.3 Apple developer release notes:
    http://news.softpedia.com/news/Seed-Notes-Arrive-for-Mac-OS-X-10-6-3-Build-10D538-132974.shtml

  5. Abhinav Kumar says:

    thumbs.db do not store metadata but thumbnails to speed up displaying of icons upon revisit…only winxp creates this file…Windows Vista/7 store meta data and thumbnails in a centralized location

  6. […] How to prevent .DS_Store file creation.  Great advice.  Easy to put in the terminal. […]

  7. Amol says:

    You can run this periodically in a terminal to delete those annoying files on a mac. However, it should be noted that they do get created every time you browse to a folder in finder.

    find / -name .DS_Store -exec rm -f {} \; -print

  8. Robert says:

    Hi, I have a problem to stop creating DS_Store file. I was trying to use command mentioned above, but it is not proceeding any further action after I insert it in terminal. I would like to ask someone, who is experienced the same issue as me.
    Thanks a mil.,
    Robert

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates