How to Stop Your Mac from Automatically Creating .DS_Store Files on Network Drives

Whenever you open a folder on your Mac, macOS secretly generates a tiny, invisible file called .DS_Store (Desktop Services Store) and places it directly inside that folder. This file is essentially a local database that remembers exactly how you arranged your icons, what background color you chose for the window, and how you sorted your list views. On a local hard drive, these invisible files are completely harmless and generally helpful.

However, if you are a Mac user working in a predominantly Windows office environment, this feature becomes a massive nuisance. When you connect to a shared Windows Server or a corporate NAS (Network Attached Storage) via SMB, your Mac will automatically scatter hundreds of these invisible .DS_Store files across the server. Because Windows does not naturally hide files starting with a dot, your PC-using coworkers will suddenly see a confusing, undeletable .DS_Store file polluting every single folder they open.

You can use a simple Terminal command to explicitly forbid macOS from ever generating these hidden preference files when interacting with a remote network drive.

How to Stop macOS from Creating .DS_Store on Network Volumes

You must write a specific configuration key to the Apple Desktop Services preferences.

  1. Open the Terminal application on your Mac (you can find it in Applications > Utilities, or search for it using Spotlight).
  2. Copy the following command exactly as written and paste it into the Terminal window:
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
  3. Press the Return key on your keyboard to execute the command.
  4. To ensure the changes take effect immediately, you must restart the Finder. Type the following command and press Return:
    killall Finder

Your Mac will immediately comply with the new rule. It will continue to generate .DS_Store files locally on your own internal hard drive, but it will completely cease dropping them onto shared network volumes, ensuring a clean, friction-free environment for your Windows colleagues.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.