What is .DS_Store and How to remove it from your macOS

Most of the users are unaware of .DS_Store files until they find it themselves someday. These files are always hidden in your system folders and working to maintain the display settings of that specific folder for the user. However, you can find the existence of these files by viewing hidden files or using Terminal to list all files in folder/directory. Also if you’re sharing with a Windows PC, you will see these files in every folder and also on Desktop. In this article, we will tell you all about .DS_Store files and how to remove them from your system.

.DS_Store file

What are .DS_Store Files in macOS?

The .DS_Store files (DS stands for Desktop Services) are automatically generated in your macOS. They contain information about how to display folders when the user opens them. These files are created by macOS Finder to save the information about icons position, size and position of the window when it was last time opened on the system. You can easily find these files through Terminal by command as shown below:

sudo ls
Checking .DS_Store files in Terminal

Note: The simple “ls” command will only show the files and folders but with sudo you will be able to see all the hidden and invisible system files.

.DS_Store file acts similar to Thumb.db, which is created automatically in Windows OS for every folder. When users copy a folder from macOS to Windows, this file will become visible.

Consequences of removing .DS_Store from macOS

.DS_Store files don’t cause any harm and take very little space in your system’s storage. But sharing files with Windows OS or uploading on OneDrive will result in failure and cause the problem for most of the users. Other than that, there is no performance benefit in deleting these files and it is best to leave them as it is. When the user happens to delete this file then the appearance of the folder will revert to the default preferences.

Method 1: Deleting .DS_Store Files for Specific Folder through Terminal

  1. Hold Command and Press Space to open Spotlight, type Terminal to search and Enter

    Opening Terminal through Spotlight
  2. Change the directory to the folder from which you want to delete .DS_Store files by using the command:
    cd desktop

    (Change desktop to the path which you want to access)

  3. Now type the following command to delete all the .DS_Store files in the current directory:
    find . –name '.DS_Store' –type f –delete

    Note: You can type –print at the end of the command to print deleted files list as shown below.

    Deleting .DS_Store files from a specific directory
  4. Files will be deleted in the following folder and it will be safe to transfer without any errors.

Method 2: Removing .DS_Store Files for all Folders on System through Terminal

  1. Hold Command and Press Space to open Spotlight, type Terminal to search and Enter

    Opening Terminal through Spotlight
  2. Use this command to remove all the .DS_Store files from the system:
    sudo find / -name ".DS_Store" –depth –exec rm {} \;
    Removing it from all directories
  3. All the .DS_Store files on the system will be removed but it will be generated for most of the folders which user or system will access.

Method 3: Cleaning .DS_Store Files by using iMyMac Cleaner

iMyMac is a cleaning tool for macOS which scans all your system for junk and inactive files. By cleaning these files, the user can save storage space and keep the system performance better. This is similar to the CCleaner on Windows, helping you removing junk files and clearing the browser cache data for users. iMyMac toolkit provides more features, like duplicate finder, mac uninstaller, file shredder, and extensions manager. We will use this utility to clean the .DS_Store files.

You can download and install it from their official website: iMyMac
After iMyMac Cleaner is installed, then follow the steps below:

  1. Hold Command and Press Space to open Spotlight, type iMyMac to search and Enter to open the application
    Opening iMyMac through Spotlight
  2. Click the Scan button on the main screen of iMyMac
    iMyMac Scanning System
  3. After the scan is done, click Review option next to the Junk Files

    Reviewing the files found after Scan
  4. You can locate the .DS_Store file and click on Clean button. But sometimes there are .DS_Store files inside the cache folders or others as shown below in Terminal:
    Cleaning .DS_Store files in iMyMac
  5. All the selected .DS_Store files or folders containing these files will be cleaned by iMyMac.
    Cleaned the junk files

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.