Thomas' Tech Tips

Disable .DS_Store File Creation on Network Volumes on MacOS

10 December 2023 - Thomas Damgaard

.DS_Store stands for “Desktop Services Store.” These are hidden files that MacOS creates within every folder.

MacOS creates .DS_Store files to ensure a consistent and personalized user experience in the Finder. When you adjust the view settings or attributes of a folder, macOS saves these preferences in the corresponding .DS_Store file. The next time you open that folder, MacOS reads the .DS_Store file to recall your preferences and display the folder as you last saw it.

However, this behavior can be problematic when these files get created on network shares or external drives, as they can appear as clutter to non-Mac users. While they’re generally harmless and small in size, they can be annoying when they get in the way or get accidentally shared with others.

To prevent macOS from creating .DS_Store files on network shares, NAS, SMB shares, and other non-local volumes, follow the steps below:

Stop .DS_Store File Creation on Network Volumes

You can use the defaults command to adjust the behavior of the Finder. Open the Terminal application and enter the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

This command tells the Finder not to create .DS_Store files on network volumes.

After executing the command, restart Finder to make sure the change takes effect:

killall Finder

Optional Cleanup: Remove Existing .DS_Store Files

If you want to remove existing .DS_Store files from a network volume, use the find command. Here’s an example that would remove all .DS_Store files from a mounted network share located at /Volumes/YourNetworkShareName:

find /Volumes/YourNetworkShareName -name .DS_Store -delete

Replace YourNetworkShareName with the actual name of your mounted volume.

Filed under: apple, finder, howto, macos, tips

Back to article list