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.
- Open the Terminal application on your Mac (you can find it in Applications > Utilities, or search for it using Spotlight).
- Copy the following command exactly as written and paste it into the Terminal window:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true - Press the Return key on your keyboard to execute the command.
- 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.