Stop Your Mac From Creating .DS_Store Files on Shared Network Drives

mac ds_store network files

macOS creates a .DS_Store file in every folder you view in Finder. This file stores metadata about that folder’s contents as well as user customizations for things like view type and icon size.

These .DS_Store files are hidden from you in macOS so they won’t clutter up your folder views. But in mixed-OS environments, the .DS_Store files can become a problem. That’s because your Mac creates these files even for shared network locations. So if you’re sharing a NAS at your office with people using Windows PCs, they may suddenly see a bunch of .DS_Store files littering the shared directories (at least, depending on how the Windows users have their view preferences configured in File Explorer).

.ds_store file windows mac
A Mac’s .DS_Store file visible in Windows.

You can manually delete .DS_Store files without losing any data. The only issue is that when you next browse to a shared folder after deleting its .DS_Store file, Finder will revert to the default layout and won’t remember any custom view types or font sizes you may have set. This approach, however, requires you to manually delete these files each time they pop up (and macOS will create a new replacement file each time you return to the shared directory). Instead, you can configure macOS to not create .DS_Store files on network shares in the first place.

Stop Creating .DS_Store Files

To configure your Mac to not create .DS_Store files on shared network drives, log into macOS, launch the Terminal, and enter the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

disable ds_store files

Once you’ve executed the command, save any open work and log out of your macOS user account. When you log back in, reconnect to your shared network drives. Existing .DS_Store files may still be present and will need to be manually deleted, but your Mac won’t create any new .DS_Store files as you browse the shared directories going forward.

.DS_Store Tidbits

As discussed above, the benefit of preventing your Mac from creating .DS_Store files is to avoid creating clutter on drives that are shared between Mac and Windows users. But since macOS hides these files by default (and even Windows can be configured to hide them), you’ll only want to prevent their creation if you know that Windows users might encounter them. In a purely Mac-based network environment, there’s no need to hide .DS_Store files, and doing so will prevent you from being able to set folder view preferences that persist between sessions.

But there is another reason to consider this process: speed. Depending on the speed of your network, the speed of your shared storage, and the number of files and directories being shared, the use of .DS_Store files may actually slow things down as you browse the network. That’s because, in addition to having to deal with a potentially slow network or slow hard drives in a NAS, your Mac has to read and process potentially thousands of .DS_Store files. In this case, the benefits of folder metadata simply aren’t worth it. Keep in mind, though, that this really only applies to the aforementioned set of circumstances. Users with fast NAS devices on gigabit or faster networks shouldn’t have an issue unless you’re dealing with an exceptionally large number of directories.

Re-Enable .DS_Store Creation

If you’ve used the command above to disable the creation of .DS_Store files on shared network drives, you can re-enable the creation of these files with the following command:

As before, make sure to log out and then reconnect your shared network drives after running the command.

Want news and tips from TekRevue delivered directly to your inbox? Sign up for the TekRevue Weekly Digest using the box below. Get tips, reviews, news, and giveaways reserved exclusively for subscribers.

source:-.tekrevue