SiftMac
Is it safe to delete? · macOS files · Updated 21 November 2026

Is it safe to delete .DS_Store files?

By Mohit Nippanikar, who makes SiftMac

The short answer
On this page
  1. What it is
  2. Where it is
  3. How big it gets
  4. How to delete them safely
  5. What happens afterwards
  6. Questions

1. What it is

The name stands for Desktop Services Store. Finder creates one in folders it opens and keeps that folder’s view options, icon positions and other visual information in it. It’s hidden on a Mac, which is why most people only meet it somewhere else: on a USB stick plugged into a Windows PC, in a zip file from a Mac user, on a network share, or committed to a Git repository.

It isn’t malware and it doesn’t mean anything is wrong. It’s also not where tags, dates or the files’ contents are kept; those stay with the files themselves.

2. Where it is

In nearly every folder Finder has opened: on your Mac, on external drives and on network shares. To see them in Finder, press ⇧⌘. (Shift-Command-period) to show hidden files, and the same keys again to hide them. To list the ones in a folder and its subfolders from Terminal:

find ~/Documents -name .DS_Store -type f

3. How big it gets

Tiny: a few kilobytes each, so even thousands of them come to megabytes. To count the ones in your home folder, then add up their size:

find ~ -name .DS_Store -type f 2>/dev/null | wc -l
find ~ -name .DS_Store -type f -exec du -k {} + 2>/dev/null | awk '{s+=$1} END {print s " KB"}'

4. How to delete them safely

On your own Mac there’s no reason to hunt them down. Clear them from a folder you’re about to share, a drive that goes into another device, or a code repository:

  1. One folder and everything in it: in Terminal, run the command below with your folder’s path in place of the example. It removes only files named exactly .DS_Store.
  2. A USB drive or SD card: close any Finder window showing it, run the same command on /Volumes/ followed by the drive’s name, then eject it.
  3. A Git repository: add .DS_Store to Git’s global ignore file so it’s never committed again, and remove any already committed with git rm --cached .DS_Store.
find /Volumes/MyDrive -name .DS_Store -type f -delete
mkdir -p ~/.config/git && echo .DS_Store >> ~/.config/git/ignore

Git uses ~/.config/git/ignore as its global ignore file by default, unless core.excludesFile or XDG_CONFIG_HOME points somewhere else. For network shares, Apple documents a setting that stops Finder using .DS_Store files on SMB shares; log out and back in after running it:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

Apple presents it as a way to make browsing a share faster; folders there then list in plain alphanumeric order. Run it again with FALSE at the end to undo it.

5. What happens afterwards

Questions

Is .DS_Store a virus?

No. It’s a normal hidden file Finder makes on every Mac. It only looks suspicious on Windows, where a dot at the start of a name doesn’t hide a file the way it does on a Mac.

Why are there .DS_Store files in a zip someone sent me?

The folder was zipped on a Mac with its hidden files included. They’re safe to delete after unzipping.

Can I stop Finder making .DS_Store files on USB drives?

Apple only documents a switch for network shares. For a USB drive, the practical way is to clear them with the find command just before you eject it.

Should .DS_Store be in .gitignore?

Yes. Put it in your global ignore file once, as above, and every repository on your Mac ignores it, so it never ends up in a commit.

How SiftMac handles it. SiftMac doesn’t list .DS_Store files, since there’s no space in them to get back. It ignores them on purpose, though: when it judges whether a project has been touched, it skips .DS_Store, because Finder rewrites it just from browsing, and it leaves it out of the Trash list.

Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works