What Is a DS_Store File and How to Remove It

How to remove DS_Store Files properly?

The DS_Store file is unknown to some computer users, but others have been searching for ways to remove it from their computers without success. If you’re one of those people, your search ends here! This article provides everything you need to know about this mysterious file and gives you some tips on how to remove it once and for all if it has made its way onto your machine.

What Is a DS_Store File?

So, let us begin by defining what is .ds_store file.

What are DS_Store files?

A .ds_store file is a hidden file that’s created automatically by the Finder app on Macs. The file contains information about how the Finder app displays certain folders and files. It also stores custom attributes of a certain folder, including icon positions, visual information, and even view options. Its name is derived from its purpose: Desktop Services Store, and its function is similar to the Windows file desktop.ini.

Pro Tip: Scan your Mac for performance issues, junk files, harmful apps, and security threats
that can cause system issues or slow performance.

Free Scan for Mac Issues
macOS compatible

Special offer. About Outbyte, uninstall instructions, EULA, Privacy Policy.

You might find a DS_Store file in any folder that you open in the Finder app. If you’re using iCloud Drive, you might also find DS_Store files in your iCloud Drive folder.

Where Does the .DS_Store File Come From?

A DS_Store file is created by MacOS when it accesses a folder. The file contains information about how the folder should be displayed in Finder, including icon size, position, and other Finder view options.

So, if you’re using a Mac and you see a DS_Store file in a folder, don’t delete it. That’s because it’s necessary for your computer to operate correctly.

Can You Delete the DS_Store File?

Now, you know what are .ds_store files. They are generally created by the Finder application on macOS to store custom attributes of a folder, such as the position of icons or the choice of a background image. But if you think these files are rather suspicious, do you think you can delete them?

Of course, you can. Well, aside from the fact that they look suspicious, there are many reasons why you would want to remove a DS_Store file. These include:

  • Finder acts up whenever you try to open a certain folder.
  • The presence of corrupted DS_store files is making it difficult for you to alter the view options or sort icons within a folder.
  • You want to reset your display preferences. By deleting a DS_Store file, you get rid of Finder’s view settings.

Are DS_Store Files Harmful?

DS_Store files are often hidden from view. That is the reason people think they are suspicious. However, as mentioned above, they aren’t actually harmful.

One way to verify whether or not the files you have are malicious is by checking the extension. Most of the time, legit DS store files have the .DS_store extension.

Once you know that this file is harmless, there are a few ways to remove it. The first option would be to right-click the file in Finder and select Move to Trash. Another option would be to use a third-party application to remove any files found in specific folders without deleting their contents, ensuring that important documents are never accidentally deleted during cleaning. We will talk more about this below.

How to Open a DS_Store File

If you wish to view and open ds_store files, do this:

  1. Click Go and select Computer.
  2. Then choose Macintosh HD. Expand the section.
  3. Next, press the CMD + Shift + period keys.
  4. At this point, all the hidden files on your device should be visible.

Removing DS_Store Files: How to Do It Properly

Below are some ways to delete a Mac .DS_Store:

When the File Is in Use by Another Program

If you can’t delete the file manually, it may be because it’s in use by another program. In that case, you can try deleting it from the command line. Use the Terminal to force-quit the process or program that’s using the file.

Just open Terminal and type rm /.DS_Store (without the quotes). You should see a message that says No such file or directory—thismeans the file is gone.

Or, if you still have an issue, look for an app called Directory Utility. Launch this app and find the offending DS_Store file in the sidebar. Click on it to highlight it, and then press Command + Delete to get rid of it.

If you still can’t delete it, try restarting your computer. That should release any locks on the file and allow you to delete it.

When the File Is Corrupted

To delete a corrupted DS_Store file, you need to use the Terminal app and be logged in as an administrator. Start by launching Finder. Then follow these steps:

  1. Navigate to the Applications folder.

How to delete a corrupted DS_Store file?

  1. Launch the Utilities folder and double-click on the Terminal app.
  2. Make sure you have super-user access to be able to use the commands needed to delete corrupted .DS_Store files.
  3. Into the command line, input the sudo ls command and hit Return.
  4. If asked for a password, input your administrator account password. In case you don’t have a password, just leave the field blank.
  5. Then go back to Terminal and input the cd command.
  6. Locate the folder that you are having issues with. Don’t open it yet. Rather, drag its icon into Terminal and see how it completes the path location for you.
  7. Hit Return.
  8. Now, delete the .DS_Store folder and everything in the folder.
  9. Type this command: rm -f .DS_Store.
  10. Press Return for the last time.
  11. Take note that Terminal won’t give any message that the command has been executed. It will only show a message in case the command does not work.

When the DS_Store File Is in a Specific Folder

If you wish to delete a DS_Store file in a specific folder, do this:

  1. Click Go and select Utilities.
  2. Next, click Terminal. You may be asked to provide your username and password if you are not signed in as an administrator.
  3. Then find the folder and change the directory to the folder that contains the DS_Store file you wish to delete. For instance, if it is saved on Desktop, input the cd desktop command and hit Enter.
  4. After that, input find .-name ‘.DS_Store’ -type f -delete. This will delete all the DS_Store files in that specific directory.
  5. Hit Enter then OK.

When the DS_Store File Is in Multiple Folders

If you want to delete all the DS_Store files on your Mac, follow these instructions:

  1. Select Go and click Utilities.
  2. Then choose Terminal.
  3. Input this command: sudo find / -name “.DS_Store” -depth -exec rm {} \;.
  4. Press Enter.
  5. Input your administrator password when prompted.
  6. All DS_Store files on your Mac should now be deleted.

When the File Is Present on Windows

If you are using a Windows device and see the DS_Store file, here’s how to delete it:

First, navigate to System Preferences. From there, select Advanced and then Get Info. Now, click on the box that says Show all filename extensions, which will make it easier for you to find these pesky files. Then type in .DS_Store into the search bar.

Once you’ve found one of these files, right-click it and hit Delete! That’s it. Keep scrolling down to learn more about this file so you can make sure that you never accidentally save another one again!

How to Schedule the Automatic Deletion of DS_Store Files

If you tend to forget or don’t want to always delete DS_Store files from your device, you can use a special command to automatically remove these files at set times. Here’s how:

  1. Click Go and select Utilities.
  2. Select Terminal to launch the app.
  3. Input this command into the command line: sudo crontab -e.
  4. Hit the Return key to execute it.
  5. If prompted, provide your administrator username and password.
  6. Next, in the vim editor, press I on your keyboard.
  7. Then input this command: 30 10 * * * root find / -name “.DS_Store” -depth -exec rm {} \;
  8. Take note that the crontab entry should be in this format: <Minute><Hour><DayOfMonth><Month><DayOfWeek><User Command>
  9. Now, press the ESC key and hit the Shift + Z + Z buttons simultaneously to save the crontab entry you have just created.

How to Prevent the Automatic Creation of DS_Store Files

DS_Store files are created automatically by macOS. But you can still prevent them from being automatically created. This will protect your information against hackers who wish to view attributes about the file and use them maliciously.

To disable the automatic creation of DS_Store files, do this:

  1. Select Go and launch Utilities.
  2. Then select Terminal.
  3. After that, input this command: defaults write com.apple.desktopservicesDSDontWriteNetworkStores true.
  4. Hit Enter.
  5. If you wish to enable it again, use the same command. However, change it to false.
  6. Finally, restart your device.

How to Fix Common DS_Store File Issues

When dealing with the DS_Store file, you may encounter various issues. We’ve listed some of them below, along with their fixes.

Issue #1: Double-clicking on the file triggers the Windows 10 cannot open message

The error message may surface because Windows cannot establish a connection between programs. To fix this, you need to install macOS X Finder for Windows 10.

Issue #2: An outdated macOS X Finder version has been installed

Are you using an outdated version of macOS X Finder? Perhaps that is the reason you are having problems with the DS_Store file. And in that case, you need to install the correct and updated version.

Issue #3: Other common issues

In some cases, the DS_Store file triggers a multitude of problems you don’t know how to fix. But it doesn’t mean they cannot be resolved. You can always troubleshoot the problem and try easy and straightfroward fixes.

One fix we recommend is to use Outbyte MacAries. This optimization software for macOS does a great job at ensuring your Mac is in good shape at all times. It scans your device for any security threats, junk files, performance problems, and other unused applications that consume a huge chunk of your storage space. It also optimizes your RAM’s performance by stopping any inactive apps to clear memory.

Wrapping Up

A DS_Store file is created by MacOS when it accesses a folder. The file contains information about how the folder should be displayed in the Finder. If you’re not using a Mac, you can safely delete any DS_Store files you find. On a Mac, you can use the Terminal to delete them automatically.

What other things do you know about the DS_Store file? Comment below!

Give us some love and rate our post!
[Total: 0 Average: 0]
Notify of
Inline Feedbacks
View all comments
Featured Stories
How to Change your Language & Region in macOS
macOS Terminal Guide: Basic to Advanced
Updating from Monterey to Ventura — Update or Clean Install?
How to Keep Your Mac Cool: Monitoring Mac CPU Temperatures
The Dark Side on Your Mac: How to Switch to Dark Mode
macOS 14 Beta 1: New Features and User Experiences
Mac Stuck on Login Screen: Comprehensive Troubleshooting Guide