How to Stop Your Mac from Automatically Creating a “.DS_Store” File on Network Drives

When you browse a folder on a Mac using Finder, macOS automatically generates a hidden file inside that directory named .DS_Store. This file remembers your custom view settings for that specific folder (e.g., whether you were using list view or icon view, window size, and icon placement).

While harmless on your local hard drive, this automation is a nightmare if you work in an office environment and regularly connect to Windows-based SMB network shares. Because Windows does not hide files starting with a dot by default, your Mac will literally litter hundreds of useless .DS_Store files all over the company servers, annoying your Windows-using colleagues and cluttering up shared directories.

You can force macOS to permanently stop generating these metadata files when connected to external network drives.

How to Disable Network .DS_Store Creation

There is no GUI setting for this preference; you must change it via the Terminal.

  1. Open the Terminal app on your Mac (you can find it in Applications > Utilities, or search for it using Spotlight).
  2. Copy and paste the following command exactly as written, and press Return:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

  1. The command will execute silently. To finalize the change, you need to restart the Finder process. Copy and paste this command and press Return:

killall Finder

Your screen will flash briefly as Finder restarts. From this moment forward, whenever you connect to an SMB or AFP network share, macOS will act as a perfect network citizen. It will read files as requested but will strictly refuse to write a .DS_Store file to the server, keeping your company’s directories clean and tidy.

Get the best tech tips delivered straight to your inbox.

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