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.
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
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
- Hold Command and Press Space to open Spotlight, type Terminal to search and Enter
- 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)
- 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.
- 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
- Hold Command and Press Space to open Spotlight, type Terminal to search and Enter
- Use this command to remove all the .DS_Store files from the system:
sudo find / -name ".DS_Store" –depth –exec rm {} \;
- 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:
- Hold Command and Press Space to open Spotlight, type iMyMac to search and Enter to open the application
- Click the Scan button on the main screen of iMyMac
- After the scan is done, click Review option next to the Junk Files
- 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:
- All the selected .DS_Store files or folders containing these files will be cleaned by iMyMac.