.DS_Store

On this page 7

.DS_Store (short for Desktop Services Store) is a hidden metadata file that the macOS Finder creates inside a folder to remember how that folder is displayed: icon positions, the chosen view, window size, sort order, background image and similar presentation settings. In the area of Finder & files, it is the mechanism that makes a folder reopen exactly as the user left it.

The file has existed since the first releases of Mac OS X and is invisible in Finder because its name begins with a dot. It contains no document content, so deleting it never harms files, but it travels with folders to network shares, USB drives, archives and code repositories, where it often becomes unwanted clutter or a privacy leak.

How Finder creates and uses .DS_Store

Finder writes a .DS_Store file when a user opens a folder and changes something about its presentation, such as moving an icon, switching to list view or resizing the window. On the next visit, Finder reads the file and restores the stored layout instead of applying the default view settings.

Internally, the file is a binary B-tree structure that begins with the magic bytes Bud1. Each record pairs a file name inside the folder with a four-character code and a value, which means the file effectively lists the names of items in the folder. The table below shows common record types.

CodeStoresExample effect
IlocIcon position for one itemIcon stays where it was dragged
bwspBrowser window settingsWindow size, toolbar and sidebar state
icvpIcon view propertiesIcon size, grid spacing, label position
lsvpList view propertiesVisible columns and sort column
vSrnView settings versionFormat revision used by Finder
cmmtFinder comment for an itemText entered in the Get Info comments field
Typical record codes stored in .DS_Store

Because the format is undocumented by Apple, its details have been reconstructed by independent developers, and records may change between macOS versions without notice.

What .DS_Store does and does not contain

A .DS_Store file holds presentation metadata only. File contents, permissions, Finder tags, quarantine flags and most other attributes live elsewhere, mainly in extended attributes attached to each file and in the file system itself.

MetadataStored in .DS_StorePrimary location
Icon positions and view styleYes.DS_Store in the parent folder
Folder background imageYes, as a reference.DS_Store plus the image file
Finder tagsNoExtended attribute on the file
Quarantine flagNocom.apple.quarantine attribute
Spotlight index dataNoSpotlight store on the volume
File type identityNoUniform Type Identifier from the extension
Where common Finder metadata is actually stored

This separation explains a frequent observation: deleting .DS_Store resets the folder layout but leaves tags, comments indexed by Spotlight and file contents untouched, although some Finder comments may be lost because they are partly mirrored in the file.

How .DS_Store compares with other Mac metadata files

Several hidden files appear when Mac folders are copied to other systems, and they are often confused. Knowing which is which helps decide what is safe to remove.

FilePurposeWhere it appearsSafe to delete
.DS_StoreFolder view settingsAny folder opened in FinderYes, recreated as needed
._ files (AppleDouble)Resource forks and extended attributesVolumes without native support, such as FAT32Usually, but attributes are lost
.Spotlight-V100Spotlight indexRoot of a volumeYes, index is rebuilt
.TrashesPer-volume TrashRoot of removable volumesYes, when Trash is empty
.fseventsdFile system event logRoot of a volumeYes, with minor side effects
Hidden metadata files created by macOS

The AppleDouble files deserve particular care. Unlike .DS_Store, they may hold a real resource fork or extended attributes, and the dot_clean command can merge them back into their parent files on a Mac before they are discarded.

Managing .DS_Store on shares, drives and repositories

Most problems with .DS_Store arise outside the Mac, where Windows users, Linux servers or version control systems see the files as ordinary content. macOS offers settings and simple commands to keep them under control.

  • Network shares: defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true stops Finder from writing the file on SMB and other network volumes after the user logs out and back in.
  • USB and external drives: defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true applies the same behavior to removable media.
  • Git repositories: add .DS_Store to a global gitignore file so it is never committed, rather than adding it to each project separately.
  • Cleanup: find . -name .DS_Store -delete removes existing files from a directory tree in Terminal.

The right approach depends on where the folder lives and who else uses it. The decision table below summarizes recommended handling.

SituationRecommended actionReason
Local folders on the MacLeave the files aloneThey preserve the user’s preferred layout
Mixed Mac and Windows file serverDisable network store writingPrevents clutter visible to Windows users
Software projectsGlobal gitignore entryKeeps commits free of irrelevant files
Website deployment foldersExclude from upload and deleteAvoids exposing file listings publicly
Archives sent to othersDelete before compressingRecipients on other systems see junk files
Recommended handling by situation

Security risks and misconceptions about .DS_Store

The main security concern is information disclosure on web servers. Because each record names an item in the folder, a .DS_Store file accidentally uploaded to a public directory can reveal file and folder names that are not linked anywhere, including backups, configuration files or administrative pages. Security scanners routinely probe for this file.

Several common misconceptions persist among Mac users and administrators:

  • It is not malware and not a sign of infection; it is a standard Finder file.
  • Deleting it is not permanent, because Finder recreates it whenever the view changes again.
  • Disabling writing on network volumes does not affect local disks; there is no supported setting to stop .DS_Store creation everywhere.
  • It does not slow down the Mac in any measurable way on local storage, although very slow network shares can delay folder display while Finder reads or writes it.

The short version

A .DS_Store file is like a sticky note Finder leaves inside a folder. It says where you put each icon, whether you like a list or a grid, and how big the window was. Next time you open the folder, Finder reads the note and arranges everything the same way.

The note is hidden on a Mac, so you rarely notice it. It becomes visible on Windows computers, shared drives and websites, where it looks like a strange extra file. Deleting it is harmless: you only lose the folder’s layout, never your documents.

Where it makes a difference

A small design studio stores client projects on a Windows file server that both Mac and Windows staff use. Windows employees complain that hundreds of .DS_Store files appear in every project folder, and a client once received a ZIP archive containing them.

The studio’s administrator runs the DSDontWriteNetworkStores command on all eight Macs, removes existing files from the server with a scheduled cleanup script, and adds .DS_Store to the global gitignore used by the web team. During the same review, a security scan finds a .DS_Store file on the studio’s public website that lists an unlinked backup archive.

After the changes, new project folders stay clean, the website file is deleted and the backup is moved off the server. The result is less clutter for colleagues and one closed information leak, with no loss of data on any Mac.