MainspringGuides › USB & Network Drives
macOS Guide

Stop your Mac creating .DS_Store on USB and network drives

Updated August 2026 · 4 min read

You've noticed .DS_Store files piling up in two places — on the USB drives you carry around and on the network share or NAS everyone maps to. They're the same hidden Finder file, but macOS controls the two locations with two separate settings. Set both and your Mac stops seeding those files on removable media and on the server at the same time.

What these files are

A .DS_Store — Desktop Services Store — is how Finder remembers the way you last viewed a folder: icon layout, sort order, window size, view style. macOS writes one into any folder it opens, wherever that folder lives: your internal disk, a USB stick, or a mounted network volume. They're hidden on macOS but plainly visible to Windows and Linux, which is why shared USB drives and company file servers end up dotted with them. On a NAS they can also multiply into thousands of tiny files across a directory tree, cluttering backups and search results.

Set both keys

Neither has a System Settings toggle — they live only in defaults. Open Terminal and run both lines:

# Stop .DS_Store on USB / removable drives
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

# Stop .DS_Store on network shares (SMB, AFP, NAS)
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

To reverse either, write -bool false for that key, or remove it entirely:

# Undo both
defaults delete com.apple.desktopservices DSDontWriteUSBStores
defaults delete com.apple.desktopservices DSDontWriteNetworkStores

Both take full effect after you log out and back in (or restart), since Finder reads them at login. They behave the same on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.

The two keys, side by side

They're independent, so setting one does nothing for the other — which is exactly why files kept appearing in one place after you'd "fixed" it. For a Mac that touches both kinds of storage, you want both on. Note that neither key affects your internal drive; there's no supported way to stop .DS_Store on the boot volume, and you wouldn't want to, since that's where Finder legitimately uses it.

Clean up what's already there

These settings are preventive. To clear existing files, run find against each mounted volume:

# Clean a mounted USB drive and a mounted share
find /Volumes/USB_DRIVE -name .DS_Store -type f -delete
find /Volumes/SERVER_SHARE -name .DS_Store -type f -delete

Substitute the real volume names under /Volumes. On a large NAS this can take a while — it's walking the whole tree — but you only need to do it once.

Both switches in one place

Mainspring turns the USB and network .DS_Store settings into labelled, one-click toggles you can flip on and reverse anytime — no two-line command, no restart guesswork. They're part of 90+ hidden macOS settings Mainspring makes reversible.

Try Mainspring free →

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

Just the network side?

If it's only your file server that's affected and USB isn't in the picture, focus on the one key — how to stop .DS_Store on network drives on Mac covers DSDontWriteNetworkStores on its own.