.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.
| Code | Stores | Example effect |
|---|---|---|
| Iloc | Icon position for one item | Icon stays where it was dragged |
| bwsp | Browser window settings | Window size, toolbar and sidebar state |
| icvp | Icon view properties | Icon size, grid spacing, label position |
| lsvp | List view properties | Visible columns and sort column |
| vSrn | View settings version | Format revision used by Finder |
| cmmt | Finder comment for an item | Text entered in the Get Info comments field |
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.
| Metadata | Stored in .DS_Store | Primary location |
|---|---|---|
| Icon positions and view style | Yes | .DS_Store in the parent folder |
| Folder background image | Yes, as a reference | .DS_Store plus the image file |
| Finder tags | No | Extended attribute on the file |
| Quarantine flag | No | com.apple.quarantine attribute |
| Spotlight index data | No | Spotlight store on the volume |
| File type identity | No | Uniform Type Identifier from the extension |
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.
| File | Purpose | Where it appears | Safe to delete |
|---|---|---|---|
| .DS_Store | Folder view settings | Any folder opened in Finder | Yes, recreated as needed |
| ._ files (AppleDouble) | Resource forks and extended attributes | Volumes without native support, such as FAT32 | Usually, but attributes are lost |
| .Spotlight-V100 | Spotlight index | Root of a volume | Yes, index is rebuilt |
| .Trashes | Per-volume Trash | Root of removable volumes | Yes, when Trash is empty |
| .fseventsd | File system event log | Root of a volume | Yes, with minor side effects |
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 truestops 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 trueapplies the same behavior to removable media. - Git repositories: add
.DS_Storeto a global gitignore file so it is never committed, rather than adding it to each project separately. - Cleanup:
find . -name .DS_Store -deleteremoves 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.
| Situation | Recommended action | Reason |
|---|---|---|
| Local folders on the Mac | Leave the files alone | They preserve the user’s preferred layout |
| Mixed Mac and Windows file server | Disable network store writing | Prevents clutter visible to Windows users |
| Software projects | Global gitignore entry | Keeps commits free of irrelevant files |
| Website deployment folders | Exclude from upload and delete | Avoids exposing file listings publicly |
| Archives sent to others | Delete before compressing | Recipients on other systems see junk files |
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.