What is a .DS_Store File? A .DS_Store file is a special type of file used in Apple's operating system (Mac OS). It is created by the Finder (Apple's file manager) to store the view settings and custom attributes for a specific folder. These settings can include icon positions, sizes, whether hidden files are displayed, and the arrangement of items within a folder window. When you open a folder on a Mac, the Finder uses the .DS_Store file within that folder to determine how its contents should be displayed. This file is typically transparent to the user but may appear in shared network drives or within folders synced to iOS devices through iTunes. Occasionally, .DS_Store files can cause issues, especially when they show up on non-Mac systems, as other operating systems generally do not recognize or handle this type of file. As a result, some users might choose to delete these files to save storage space or avoid compatibility problems. In summary, .DS_Store files are a mechanism created by Mac OS to provide personalized folder views, although they are generally invisible to the average user, they play an important role within the system.

In Apple's macOS operating system, a .DS_Store file contains custom attributes of a folder, such as view options, icon positions, and other visual information. The name is an acronym for "Desktop Services Store," reflecting its purpose. —— Source: Wikipedia

.DS_Store is a hidden file that is automatically generated on the macOS operating system. A .DS_Store file on a Mac is created by the Mac OS X operating system in any folder that has been opened with the Mac Finder, including network folders. Its purpose is to "remember" the position of icons and the background of a folder.

What is .DS_Store File on Mac

In OS X, these files are hidden and normally aren't seen, but from Windows or a Linux file system type, we would see them in all the directories we were looking at with Finder before.

As such, the .DS_Store serves a similar purpose to the Windows desktop.ini or thumbs.db files, except that the latter only appear in folders containing images as they are thumbnail databases.

How to Find .DS_Store Files on a Mac

The .DS_Store file extension begins with a period, which makes it a hidden file that's not visible to the user. However, when you enable the "Show All Files" feature on your Mac, .DS_Store files may suddenly appear on your desktop or in open folders. If you want to show hidden files on your Mac, you can enable this feature. If you transfer data from your Mac to Google Drive, you'll see many hidden files, including .DS_Store.

Show Hidden Files

The quick way to reveal hidden files in a folder is to open Finder, then press Command + Shift + Dot (period). If you want to hide them again, just press Command + Shift + Dot again.

Once you find the hidden file, right-click on it to learn more about it, and click "Open With" to choose a suitable app on your Mac. If you can't find a compatible program, search for free online .DS_Store openers.

.DS_Store file opens with...

Please share this article on social media so you can read it later.

Please provide the specific English content to be translated.

How to Hide .DS_Store Files on a Mac

If seeing all these files cluttering up your desktop is annoying, you can hide them instead of deleting them, since your Mac will just keep creating new .DS_Store files. To hide .DS_Store files on your Mac, do the following:

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

Step 2. Type in the following command: defaults write com.apple.finder AppleShowAllFiles FALSE.

Step 3: Press the Enter key.

Step 4: Exit the Finder by using the command killall Finder.

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

Force Quit Finder

How to Delete .DS_Store Files on a Mac

.DS_Store files store information about Finder windows, such as list view, icon view, custom icon arrangements, and more. It's safe to delete them, but after doing so, the folder will revert to its default preferences. If you don't care about the data in .DS_Store files on your Mac, then they're unnecessary, but they'll eventually be recreated. As such, deleting them isn't really a solution.

You can learn more about the error that occurs when deleting .DS_Store files on a Mac, along with potential solutions, by watching this video:

    • 00:03 - Introduction
    • 00:45 - Potential Errors
    • 01:20 - Solutions

How to Delete .DS_Store Files

If you don't want to keep the information stored in a .DS_Store file, you can delete them. Here's how to remove .DS_Store files from your Mac:

Step 1: Choose Applications > Utilities to open 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 prompted.

How to Automatically Delete .DS_Store Files

In addition to manually deleting them, if you find this process tedious, I recommend setting up an automated command to remove .DS_Store files. Here's how to automatically delete .DS_Store files on a regular basis:

Step 1: Choose Applications > Utilities to open Terminal.

< strong > Step 2:</strong> Enter the following UNIX command: < strong >sudo crontab -e.</strong>

Step 3: When prompted, enter your Mac OS X administrator password.

4. Press the "I" key on your keyboard, then type the following command within the Vi editor: "15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;"

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

The command runs automatically every day at 1:15 AM. Use different values to configure a different time.

Note: If your computer is turned off at the scheduled time, the command will not run.

How to Stop .DS_Store Files from Being Created on Shared Network Drives

While you can't prevent macOS from creating .DS_Store files on your local drives, you can stop them from automatically generating on shared network drives. Here's how:

Step 1: Open Finder, go to Applications, then Utilities, and open Terminal on your Mac.

Open the Terminal from Utilities

Step 2. Type in the following command: defaults write com.apple.desktopservices DSDontWriteNetworkStores true.

Input the command

Step 3. Restart your Mac, and the .DS_Store files should no longer be uploaded to network drives.

Conclusions

.DS_Store files are automatically generated by the Mac OS X operating system in any folder that has been opened with the Mac Finder, including network folders. If you have "Show All Files" enabled on your Mac, you can spot them. You can quickly get rid of .DS_Store files on your Mac, but the folder will revert to its default appearance, and a new, blank .DS_Store file will be created the next time you open the folder. For this reason, it's recommended to hide them instead of deleting them if you don't want to see them.