MainspringGuides › Stop .DS_Store on network drives
macOS Guide

Stop .DS_Store files appearing on network drives and USB

Updated 2026 · 4 min read

Every time you browse a folder on a Samba share, NAS, or USB drive, macOS quietly writes a .DS_Store file to store view settings like icon positions and sort order. On local drives that's harmless. On shared drives, it's a constant source of noise for Windows and Linux users — and most NAS admins.

Why .DS_Store on network drives is a problem

On a local Mac drive, .DS_Store files sit quietly and nobody sees them. On a network share the situation is different:

macOS has had a built-in fix for this since Mac OS X Leopard: a single preference key called DSDontWriteNetworkStores. It's just never been exposed in System Settings.

The fix: one Terminal command

Open Terminal (Applications › Utilities) and run:

# stop writing .DS_Store to network & USB drives
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

No killall Finder needed. The change takes effect the next time you mount a network volume or USB drive — eject whatever you have connected and remount it.

What this setting does (and doesn't) affect

A common point of confusion: this preference applies to network volumes and USB/external drives only. Your local hard drive and internal SSD are unaffected — Finder will still write .DS_Store files there to remember your local folder preferences. That's the right trade-off: local view settings are useful; polluting a shared drive is not.

Specifically, macOS treats any volume mounted under /Volumes/ as a network or removable drive for the purpose of this setting. That covers:

Cleaning up .DS_Store files already on a share

Turning off future writes doesn't remove files that are already there. To clean up an existing volume, replace /Volumes/YourShare with the actual mount path of your drive:

# preview what will be deleted (dry run)
find /Volumes/YourShare -name '.DS_Store' -type f

# delete them all
find /Volumes/YourShare -name '.DS_Store' -type f -delete

Run the preview line first so you can see exactly what will be removed before committing. On a large NAS with years of Mac browsing, this can remove thousands of files instantly.

If the share is on a Linux or Windows server you have SSH access to, you can run the same find command directly on the server — it's faster than doing it from the Mac over the network.

Do it in one click

Mainspring includes a Stop .DS_Store on network drives toggle that sets this preference without opening Terminal. Flip it on, and Mainspring records the original state so you can reverse it just as easily.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

How to undo it

If you want macOS to resume writing .DS_Store files to network drives and USB volumes, set the preference back to false:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool false

Or delete the key entirely to restore the factory default:

defaults delete com.apple.desktopservices DSDontWriteNetworkStores

Remount your volume and Finder will start creating .DS_Store files there again.

Verify the setting took effect

After mounting a drive and browsing a few folders on it, check whether any .DS_Store files were created:

find /Volumes/YourShare -maxdepth 3 -name '.DS_Store'

If nothing appears, the preference is working. You can also read back the current value at any time:

defaults read com.apple.desktopservices DSDontWriteNetworkStores

A result of 1 means the setting is active.