Home > Wiki Tips

DS_Store Files (What & How to Open,Hide,Delete & Disable)

Updated on Wednesday, April 24, 2024

iBoysoft author Jenny Zeng

Written by

Jenny Zeng
Professional tech editor

Approved by

Jessica Shee

English Deutsch

What is A DS_Store File (How to Open,Hide,Delete & Disable)

Summary: This post explains the DS_Store files on Mac's desktop, on a Windows PC, in Google Drive and GitHub repository. It also gives you the details to open, hide, delete and disable DS_Store files on Mac.

DS_Store files on Mac, Windows and GitHub

What is a DS_Store file?

DS_Store (shortened for Desktop Services Store) files, the macOS version of Windows's desktop.ini files, are automatically created by Finder on local internal & external disks or remote file systems mounted from servers to store a folder's custom view preferences. Such as an icon's position, the chosen view option, the choice of a background image, the folder's window location & size, and column sorting.

Where will you see DS_Store files?

The file extension (.DS_Store) starts with a period, signaling a hidden file ordinarily invisible to users. However, you will see them suddenly showing up on the desktop or in an open folder when copied to a Windows PC, copied over a network, restored from a backup, or accidentally enabled Show All Files on Mac. In a word, a DS_Store file will be generated on every folder Finder accesses.

On macOS 10.11 and earlier, you will see the DS_Store files on the desktop or any folder after configuringyour Mac to show hidden files. However, Since macOS 10.12, the DS_Store files won't display even when the defaults write com.apple.Finder AppleShowAllFiles TRUE command is applied.

Tried on macOS Monterey, other hidden folders like .tmp will appear after executing the command but not the DS_Store files.

DS_Store files in Google Drive

When transferring data from Mac's external SSD to Google Drive, you will notice many hidden files, including DS_Store files being uploaded.

DS_Store files on Windows PC

If you are a cross-platform user or used to receiving files shared from a Mac, you will notice DS_Store files when opening a Mac-created folder or archive on Windows.

DS_Store files in GitHub repository

GitHub repository tracks all changes made to a file, including the DS_Store files. To avoid committing unnecessary stuff, you can use the .gitignore files located in the root directory to ignore DS_Store files by following the steps given in this post.

How to open DS_Store files on Mac/Windows?

Different apps may use the same file extension.DS_Store for different types of data, so there's no specific DS_Store opener for all kinds of files.

To open DS_Store files in Windows, you can right-click on the file, click Open With, then choose an application. Some user-suggested applications are Windows Notepad, WinRAR, Free File Viewer, Adobe Acrobat, Microsoft Office, etc. Also, try dragging the file to a browser to open it.

To open DS_Store files on Mac, you can right-click on the file, click Open With, then choose a proper application. If no compatible software is found, look for a free online DS_Store file opener.

Can I delete DS_Store files on Mac?

Yes, you can delete DS_Store files on Mac without losing crucial data. But the folder appearance will revert to the default preferences. Besides, a new blank DS_Store file will be created the next time you open the folder. If you don't want to see them, you're recommended to hide them rather than delete them.

How to hide DS_Store files on Mac?

To hide DS_Store files on Mac:

  1. Open Finder > Applications > Utilities > Terminal.
  2. Input the following command and press Enter.defaults write com.apple.finder AppleShowAllFiles FALSE
  3. Use this command to exit Finder.killall Finder

If the DS_Store file is still visible, you can force quit Finder, then check if the file is hidden.

How to delete DS_Store files on Mac?

To delete DS_Store files in a specific folder on Mac:

  1. Open Finder > Applications > Utilities > Terminal.
  2. Execute the command below to locate the folder you want to delete the DS_Store files.cd folderpath 
    E.g., To delete all DS_Store files on the desktop, enter cd desktop and press Enter. To delete all DS_Store files on other folders, type cd followed by a space, drag the folder icon to Terminal, and press Enter.
  3. Type the following command and hit Enter.find . –name '.DS_Store' –type f –delete
  4. Select OK.

To delete all DS_Store files on Mac:

  1. Open Finder > Applications > Utilities > Terminal.
  2. Enter the following command and hit Enter.sudo find / -name “.DS_Store” -depth -exec rm {} \;
  3. Enter the administrator password.

To delete all DS_Store files on Mac automatically and regularly

  1. Open Finder > Applications > Utilities > Terminal.
  2. Paste this command and press Enter.sudo crontab -e
  3. Enter the administrator password if required.
  4. Open your vim editor and press the I key once.
  5. Then type this command:Minute Hour DayofMonth Month DayofWeek root find / -name “.DS_Store” -depth -exec rm {} \; 
    E.g. To automatically delete DS_Store files at 9:45 a.m every day, use: 45 9 * * * root find / -name ".DS_Store" -depth -exec rm {} \;
  6. To save the crontab entry, press Esc once, then press Shift + Z + Z simultaneously.

The command will run when your Mac is on or in Sleep mode.

How to disable the automatic creation of DS_Store files on Mac?

Although you can't stop macOS from generating the DS_Store files on local drives, you can disable the automatic creation of DS_Store files on shared network drives by following these steps:

  1. Open Finder > Applications > Utilities > Terminal.
  2. Execute the following command:defaults write com.apple.desktopservices DSDontWriteNetworkStores true 
  3. Restart your Mac.

People Also Ask

Read More Questions