Disable Creation of .DS_Store Files by macOS

Overview

The macOS Finder uses an invisible file to store metadata to remember window size, sort order, view mode, etc. This file is called ".DS_Store" which is invisible on the Mac, and most Linux/Unix systems but are typically visible to Windows. Mac users who connect to Windows file shares or use USB with FAT32 or ExFAT file systems leave behind these little bread crumbs which are visible to Windows. 

The Mac doesn't have any way to disable this feature in its system preferences; however, it does have command line tools for just this purpose.

In this article:

 

What materials do I need?

  • You'll need to be logged into the user account on the Mac that is writing the unwanted .DS_Store files. 
  • You'll also need the Terminal application. 

 

How do I use the Technology?

Important
You will need to logout/login or restart to see affected changes. Additionally, this is not a global change; it only affects the individual user that executes these commands. The default view for any SMB or USB mounted volumes will always revert to display defaults.
The security features in later versions of macOS may prompt you for permission to allow the Terminal application to access to the file system. That is normal and OK to allow. 

 

Disable .DS_Store files on network shares

  1. Open the Terminal application.
  2. Enter the following command to disable writing .DS_Store files to network storage file shares:

    defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
     
  3. Press the Return key.

 

Disable .DS_Store files on removable media

  1. Open the Terminal application.
  2. Type the following command to disable writing DS_Store files to USB drives:

    defaults write com.apple.desktopservices DSDontWriteUSBStores -bool TRUE
     
  3. Press the Return key.

 

Re-enable .DS_Store

You can reverse changes made by flipping their boolean values back to FALSE.

  1. Open the Terminal application.
  2. Type either, or both, of the following command to enable writing DS_Store files, pressing the Return key between each command.
    • Network file shares:

      defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool FALSE
       
    • External storage media:

      defaults write com.apple.desktopservices DSDontWriteUSBStores -bool FALSE

 

Is there any additional information I should know about?

Apple's Adjust SMB browsing behavior in macOS support article provides some additional information regarding viewing folder content.

 

Need additional help or have issues

For additional assistance contact the IT Services Technical Support Center via phone at (907) 786-4646, toll-free at (877) 633-3888, email us at uaa.techsupport@alaska.edu.