Ever browsed a network shared folder on your Windows PC and seen a bunch of mysterious “.DS_Store” files? These hidden files are a byproduct of macOS, storing information like icon view preferences and custom backgrounds for folders. While harmless, they can clutter up your shared drives and cause headaches for non-Mac users.

Luckily, there’s a simple way to prevent Macs from creating these .DS_Store files on network shares. Here’s how:

Using Terminal:

  1. Open the Terminal app (Applications > Utilities).
  2. Enter the following command and press return:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

This command instructs macOS not to write .DS_Store files to network volumes.

  1. Restart your Mac for the changes to take effect.

Verifying the Setting (Optional):

If you’re curious, you can verify the setting with another Terminal command:

defaults read com.apple.desktopservices DSDontWriteNetworkStores

This should return “true” if the setting is enabled.

Run the following command in Terminal to delete existing .DS_store files (replacing /<YourShareName> with the location of your network share drive

find /<YourShareName> -name ".DS_Store" -delete

What to Expect:

After implementing this change, Macs will no longer create .DS_Store files on network shares. Existing .DS_Store files might remain, but they won’t cause any harm. You can manually delete them if desired.

Benefits:

  • Cleaner Network Drives: No more clutter from hidden .DS_Store files.
  • Improved Performance: Browsing network shares might feel snappier without the overhead of writing these files.
  • Compatibility Boost: Prevents permission errors that can sometimes arise with .DS_Store files on shared drives.

Keep in Mind:

This setting only affects Macs. Windows and other operating systems won’t be impacted.

Conclusion:

By preventing the creation of .DS_Store files, you can streamline your network share experience and ensure a smoother workflow for all users, regardless of their platform. With this simple Terminal tweak, you can keep your shared drives organized and clutter-free.