How to remove .DS_Store files on Mac?

In the macOS, there are some files that are created automatically in different directories. Although they may seem useless, they play an important role in the proper functioning of the operating system, and so should not be deleted. One such file is a .DS_Store file. In this article, we’ll explain what it is and how to remove it, along with the reasons why you might need to do it.

What is .DS_Store?

While it appears to be a useless addition to a folder, a .DS_Store file (the “DS” stands for “Desktop Services”) is important in helping Mac work out how to display folders when you open them. 

The Finder creates the file whenever a .zip file is created and contains information about how a folder will be opened, such as icon positions, window size and shape, and the window’s position when last opened on the desktop. You might also find .DS_Store files in archives that you’ve received from other Mac users.

The files, as they sit in a folder on your Mac, don’t cause any harm, which is good because the only way to stop them from being created is to quit using the Finder, and that’s something none of us want to consider. 

why-delete-ds-store-files

Why would you need to delete DS_Store files?

So why would you want to get rid of a file that doesn’t cause any harm and takes up very little space in a folder? Here are a few reasons:

  1. You want to reset your display settings.
  2. The Finder is behaving oddly when opening a folder. As with any computer file, it’s possible for .DS_Store files to become corrupted. Things such as the inability to see or sort icons, change view options, or a folder that closes within a second of being opened are a sure sign of a .DS_Store gone bad.
  3. You’re transferring files between your Mac and another system. When moving files from your computer over to a Windows or Linux system, a .DS_Store file can cause unexpected problems. They’re alien to PCs and can raise suspicions from users unfamiliar with macOS.
how-delete-ds-store-files

How to delete a .DS_Store file 

Before we show you how it’s done, let us, first of all, reassure you that deleting a .DS_Store file is perfectly safe. No harm will come to a folder. 

You should also know that as soon as the settings are changed, the Finder will create a new .DS_Store file that you’ll probably want to delete at some point. Basically, it’s a never-ending battle — you versus .DS_Store. 

Deleting .DS_Store files: The easy way

Using a tool like CleanMyMac X lets you delete .DS_Store files easily and in bulk without having to go down the manual route of entering Terminal commands. It’s also a sure-fire way of making sure every trace of .DS_Store is removed from your folders. 

.DS_Store falls under the category of System Junk on CleanMyMac X, which is essentially what it is when you no longer need a file. Removing files couldn’t be simpler:

  1. Download CleanMyMac X (for free!).
  2. Open the app.
  3. Click on System Junk from the sidebar menu.
  4. Hit Scan and wait for CleanMyMac to do its thing.
  5. Click Clean for no more .DS_Store dictating how your folders should look.
CleanMyMac X - System junk scan complete

And you’re all done. There won’t be a .DS_Store file to be found… Until your Mac creates a new one.

Deleting .DS_Store files manually

If you want to go down the manual route and delete .DS_Store files individually, you can do this using the Terminal: 

  1. Go to Applications > Utilities > Terminal.
  2. Locate the folder or directory that you want to remove the .DS_Store file from.
  3. Type cd into the Terminal followed by your folder path, so it looks something like this: cd /Users/username/nameoffolder
  4. Press Return.
  5. Type find . -name ‘.DS_Store’ -type f -delete
  6. Press Return again. 

The .DS_Store files in the selected folder will now disappear.

Keep your Mac junk-free 

.DS_Store files are useful for retaining viewing preferences so that folders display in the way the creator intended. But the second these preferences aren’t required, or a file acts up, it’s best to remove them from your Mac using either of the ways we’ve shown you here and start afresh. 

CleanMyMac X is designed to rid your system of junk files with minimum fuss to ensure your Mac runs exactly how you like it. Download it now to keep folders and files working seamlessly.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.