MainspringGuides › .DS_Store on USB
macOS Guide

Stop your Mac writing .DS_Store files to USB drives

Updated August 2026 · 4 min read

You copy a folder onto a USB stick, hand it to a colleague on Windows, and they see a stray .DS_Store file sitting next to your documents. It's harmless, but it looks messy and prompts "what is this?" every time. macOS has a setting that stops Finder writing those files to USB drives — one defaults command and a logout, and your handoffs stay clean.

What .DS_Store actually is

Short for Desktop Services Store, a .DS_Store file is where Finder saves how you last viewed a folder: icon positions, window size, sort order, the view style, and background. macOS drops one into every folder you open in Finder, including folders on external media. On your Mac it's hidden and invisible, so you never notice. On Windows and Linux, where the leading dot means nothing, it shows up as a plain file in the listing — which is why USB drives you share suddenly look cluttered.

Turn off .DS_Store on USB drives

Open Terminal (Applications → Utilities) and run:

# Stop writing .DS_Store to USB / removable volumes
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

# Undo — let macOS write them again
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool false

There's no System Settings switch for this — the defaults command is the only route. The change takes full effect after you log out and back in (or restart), because the Finder process that writes these files reads the setting at login. It works the same on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.

Clean up the ones already there

The setting only prevents new .DS_Store files — it won't remove the ones already on the drive. Clear those with the drive mounted:

# Delete existing .DS_Store files on the mounted USB drive
find /Volumes/YOUR_DRIVE_NAME -name .DS_Store -type f -delete

Replace YOUR_DRIVE_NAME with the drive's name as it appears under /Volumes. After this, and with the setting on, the drive stays free of them.

One thing this doesn't cover

If your Windows colleagues also see files whose names start with ._ (a dot and an underscore), those are a separate thing — AppleDouble files that store metadata when a Mac copies to a drive it can't store that metadata on natively, like FAT or exFAT. The DSDontWriteUSBStores key does not stop those; it only governs .DS_Store. You can strip existing ._ files from a mounted drive with dot_clean /Volumes/YOUR_DRIVE_NAME. Knowing the difference saves confusion when a drive still isn't perfectly clean after the main fix.

Skip the Terminal

Mainspring turns "don't write .DS_Store on USB drives" into a labelled, one-click toggle you can flip on and reverse anytime — no commands, no logout guesswork. It's one of 90+ hidden macOS settings Mainspring makes reversible.

Try Mainspring free →

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

Do the same for network shares

If you also drop files onto a shared server or NAS, there's a matching key for that — stop .DS_Store on network drives covers DSDontWriteNetworkStores, the sibling setting.