What Is .DS_Store Files | Find, Delete, Hide, on Mac

Brithny updated on Oct 25, 2024 to Knowledge Center | How-to Articles

This article will introduce what .DS_Store files are and how to find/open/hide/delete them on Mac. You can't prevent your Mac from generating .DS_Store files on Mac local drives, but you can stop creating them on shared network drives. Just read this article to know the detailed information.

What Is .DS_Store Files

In the Apple macOS operating system, .DS_Store is a file that stores custom attributes of its containing folder, such as folder view options, icon positions, and other visual information. The name is an abbreviation of Desktop Services Store, reflecting its purpose. - from Wikipedia

.DS_Store is an invisible file on the macOS operating system that gets automatically created. .DS_Store files on Mac are created by the Mac OS X operating system in any directory (including network folders) that is opened with Mac Finder. Its function is to "memorize" the icons' position and the folders' background.

Under OS X, these files are hidden, and as a general rule, they are not seen, but from Windows or Linux file system type, we will see them in all the directories we have previously viewed with Finder.

So, the function of .DS_Store is more or less like the Windows desktop.ini or the thumbs.db, only that the latter only appears in directories containing images since it is a database of thumbnails.

How to Find .DS_Store Files on Mac

.DS_Store file's extension starts with a period, meaning it is a hidden file that is invisible to users. However, you can see .DS_Store files on Mac suddenly appear on your desktop or in open folders after enabling the "Show All Files" function on your Mac. So, if you want to show hidden files on Mac, you can enable it. Suppose you transferred data from your Mac to Google Drive; you can see many hidden files, including .DS_Store files.

A quick and easy way to find secret files within a folder is to open the Finder and press Command + Shift + Dot (full stop/period). When you no longer want to see the hidden folders, just press Command + Shift + Dot again.

And once you find these invisible files, you can right-click on the file to learn detailed information about it and click on "Open With" to select a proper application on your Mac. You can search for a free online .DS_Store file opener if no compatible software is found.

Share this article on social media so that you can read it anytime.

 

How to Hide .DS_Store Files on Mac

If showing all types of files puts your desktop in disorder, hiding them rather than deleting them is suggested because your Mac will re-creat .DS_Store files repeatedly. Follow the steps below to hide .DS_Store files on Mac:

Step 1. Open Finder, go to Applications, select Utilities, and click Mac Terminal.

Step 2. Input the following command: "defaults write com.apple.finder AppleShowAllFiles FALSE".

Step 3. Press Enter.

Step 4. Use this command "killall Finder" to exit Finder.

If the .DS_Store files are still visible, you should force quit Finder, then check if the files are hidden.

How to Delete .DS_Store Files on Mac

.DS_Store files store Finder window information, like list view, icon view, custom icon arrangements, etc. It's safe to delete them, but after you delete them, the appearance of folders will revert to the default preferences. Suppose you don't care about saving the data .DS_Store files stored on your Mac, those files are dispensable, but they will re-create themselves eventually. Thus, deleting them is not really work.

You can refer to this video for detailed information about errors and reference solutions when you delete .DS_Store files on Mac:

  1. 00:03 - Introduction
  2. 00:45 - Errors may occur
  3. 01:20 - Solutions

How to Delete .DS_Store Files

If you don't want to save the info your .DS_Store files stored, you can choose to delete them. Follow the steps below to delete .DS_Store files on Mac:

Step 1. Select Applications > Utilities to launch Terminal.

Step 2. Enter the following UNIX command: "sudo find / -name ".DS_Store" -depth -exec rm {} \;".

Step 3. Enter your Mac OS X Administrator password when it prompts.

How to Automatically Delete .DS_Store Files

In addition to manual deletion, if you are tired of the tedious process, I recommend you set the automatic command to delete .DS_Store files. Here's how to automatically remove .DS_Store files periodically:

Step 1. Select Applications > Utilities to launch Terminal.

Step 2. Enter the following UNIX command: "sudo crontab -e".

Step 3. Enter your Mac OS X Administrator password when prompted for a password.

Step 4. Press I on your keyboard once and enter the following command: "15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;" in the vi editor.

Step 6. Press the Esc key once to save the entry.

The system automatically runs the command at 1:15 AM every day. To configure the order for a different time, use different values.

Note: the command is not run if your computer is switched off at the scheduled time.

How to Prevent Automatic Generation of .DS_Store Files on Shared Network Drives

You can't prevent macOS from creating .DS_Store files on local drives, but you can disable the automatic generation of .DS_Store files on shared network drives. Just follow the steps below:

Step 1. Open Finder, go to Applications, choose Utilities, and open Terminal on Mac.

Step 2. Put the following command: "defaults write com.apple.desktopservices DSDontWriteNetworkStores true".

Step 3. Restart your Mac, and .DS_Store files will not share to your Network drives.

Conclusion

.DS_Store files are generated automatically by the Mac OS X operating system in any directory (including network folders) that is opened with Mac Finder. Enabled the "Show All Files" function on your Mac so you can find them. Suppose you want to delete .DS_Store files on your Mac, you can delete them quickly. But the appearance of folders will revert to the default preferences and new blank .DS_Store files will be created the next time you open the folder. So, if you don't want to see them, hiding them rather than deleting them is suggested.