.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.
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.
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.
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.
Please share this article on social media so you can read it later.
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.
.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:
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.
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.
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.
Step 2. Type in the following command: defaults write com.apple.desktopservices DSDontWriteNetworkStores true.
Step 3. Restart your Mac, and the .DS_Store files should no longer be uploaded to network drives.
.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.