Everywhere All articles Download Buy for $19

How macOS actually works

What .DS_Store is and how to get rid of it

Updated 2026-10-30 · 4 min read

A .DS_Store file is a hidden note Finder leaves in folders about how to display them. It is safe to delete. Here is how to remove them from a folder tree, stop them on network shares and keep them out of Git.

What it is, and how to delete it

.DS_Store is a hidden file that Finder creates inside folders it has shown. It stores how Finder displays that folder, such as icon positions, view style and window settings. It holds no documents, so you can delete it. The only loss is that folder's saved layout: Finder writes a new .DS_Store the next time it shows the folder, starting from the default view.

List them in one folder tree first. This only prints:

find ~/Desktop -name .DS_Store -type f

Once you've read the list, the same command with -delete at the end removes them:

find ~/Desktop/ClientFiles -name .DS_Store -type f -delete

Change the path to the folder you mean, or type find , drag a folder onto the Terminal window and add the rest of the command.

Deleting them without surprises

The man page for find warns that -delete acts the moment it is evaluated, so it belongs last in the command and the -print form comes first. Deleting this way skips the Trash.

Keep the search to a folder you chose. Run on /, find walks the whole disk, system folders included; ~/Library and app bundles are places you have no reason to hand to anyone, so leave them alone.

In a single folder you can also do it by hand. In Finder, press ⇧⌘. to show hidden files, select .DS_Store and press ⌘⌫. The guide to showing hidden files on a Mac has the other ways.

They return as you browse. Deleting them on your own Mac only keeps folders tidy for a moment, so do it when you are about to hand a folder or drive to someone else.

Why other computers show them

Finder writes .DS_Store into any folder it displays, and other systems treat it as an ordinary file. That is why you notice it in these places:

Stopping them on network shares

Apple documents one setting for this, and it is for network shares, not USB drives:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

Then log out of your account and back in. To undo it, run the same command with FALSE.

Apple's current article, "Adjust SMB browsing behavior in macOS", is written for administrators and describes the setting in terms of speed: it stops macOS reading .DS_Store files on SMB shares, so Finder shows each folder's contents straight away in alphanumeric order. An older Apple article for Mac OS X 10.4 and later, now retired, gave the same key as the way to prevent .DS_Store file creation over network connections, and that is what most people use it for.

To see whether the setting is on, run:

defaults read com.apple.desktopservices DSDontWriteNetworkStores

If that prints The domain/default pair ... does not exist, nobody has set it on this account. It does not cover local folders or external drives. A similar key for USB drives circulates online, but Apple doesn't document it, so it is left out here.

Keeping them out of Git

If .DS_Store keeps showing up in git status, ignore it for every repository on your Mac. Git's documentation says its default global ignore file is ~/.config/git/ignore, so create it and add the name:

mkdir -p ~/.config/git
echo ".DS_Store" >> ~/.config/git/ignore

If you have already set core.excludesFile in ~/.gitconfig, add the line to that file instead. Files that are already tracked stay tracked; remove one from the repository without deleting it from disk with git rm --cached path/to/.DS_Store and commit. A .gitignore containing .DS_Store in the repository does the same job for everyone who clones it.

Checking a drive before you hand it over

Everywhere indexes hidden files, so it can show you which folders on a drive have a .DS_Store before you hand it over. Type path:DriveName .DS_Store (swap in the drive's name) and each result shows the folder it sits in. External drives are only in its index once it has Full Disk Access. It lists the files and leaves the deleting to you: use the commands above, or select a result and press ⌘⌫ to move it to the Trash.

Common questions

Can I delete .DS_Store files on a Mac?

Yes. They only store how Finder displays a folder. Finder recreates one when you next open the folder, and that folder's view settings start from the defaults.

How do I delete all .DS_Store files on a Mac?

List them with find <folder> -name .DS_Store -type f, then repeat the command with -delete on a folder you chose. Avoid /, ~/Library and app bundles.

How do I stop .DS_Store files being created on network drives?

Run defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE, then log out and back in. Apple's current article describes it as stopping macOS reading .DS_Store files on SMB shares; an older Apple article gave it for preventing their creation on network connections. Use FALSE to undo it.

How do I stop .DS_Store showing up in Git?

Add .DS_Store to ~/.config/git/ignore for all your repositories, or to a .gitignore in the repository. Already-tracked copies need git rm --cached once.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac, including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support