Do you use a MacBook? Then, you need to remain cautious of DS_Store files. But what are they? It may happen that you are exposing information about your website Or app unknowingly. If you want to know what the .ds_store file is and other details related to it, check this article.
What is a .DS_Store file?
A .DS_Store is the abbreviation of Desktop Services Store. This is an invisible file on macOS, and your system can create the file automatically whenever you use a ‘Finder’ to find the folder. After that, the file follows the folder wherever it goes, even when it is archived in ‘ZIP.’
Suppose you are a developer or system administrator and willing to transfer files from a PC to your server. Or suppose you have not taken any essential precautions with the automated deployment procedure. If it is the case, it may happen that unconsciously, you are putting the files on those servers where your site or apps remain.
Why should you know about .DS_Store File?
These files can store information or custom attributes of the containing folder along with other file names. Therefore, hackers can do malicious work if you expose the information by chance, allowing the hackers to view your private files.
This file was exploited in 2015. It was previously used so that people could access the TCL Corporation’s admin portal, a multinational Chinese electronics company. You should know that the app’s whole backend and database can be exposed to those who have access to the .DS_Store file.
Purpose and location:
The location of the file is a folder or directory accessed by the Finder app; it can remain on remote file systems mounted from Server Message Block (SMB) protocol, the Apple Filing Protocol (AFP), and other servers that can share files. However, your OS settings, like permissions, can exclude Remote file systems. However, Finder uses these files, which can be assumed to be a more metadata’s general-purpose store regarding the folders’ display options like icon positions and view settings. For instance, these files have spotlight comments on Mac OS X 10.4 “Tiger ” and later. However, the comments can be stored in the extended file attributes, but the issue is Finder cannot read these.
If it comes to talking about the earlier Apple OS, you should know that Finder apps can generate similar files. However, if foreign file systems can be accessed at the volume’s root, it can collect every setting for the files that remain on the volume.
Where will you see DS_Store files?
Generally, these are invisible, but you can find these hidden files suddenly on the desktop. Besides, these can be seen suddenly in an open folder that has been copied to a Windows PC or over a network. In addition, you can get to see the files when it gets restored from a backup or if you, by chance, enable Show All Files on Mac.
So, we can say that the file can be created on each folder that Finder has access to. Besides, these files can be seen on a PC or any folder if you use MacOs 10.11 and earlier. But remember that you can see them in the folder only after configuring the Mac to display hidden files. For example, the files can’t be seen if the default write com.apple.Finder AppleShowAllFiles TRUE command.
DS_Store files in Google Drive:
If you transfer data from the external SSD to Google Drive, multiple hidden files, such as DS_Store files, are uploaded.
DS_Store files on Windows PC:
Are you a cross-platform user? Or do you receive files shared from Mac? Then you will get to see these files when you open a Mac-created folder or archive on Windows.
DS_Store files in the GitHub repository:
GitHub repository can track all changes created to a file such as DS_Store. If you do not want to commit unnecessary stuff, try to use .gitignore files available in the root directory so that you can ignore these files.
How to open DS_Store files on Mac/Windows?
Several Apps can use the same file extension.DS_Store for several data types. Therefore, no particular opener is there for the files.
On Windows:
If you want to open these files in your Windows, you need to right-click on the file first. Then, you must tap on the option “Open With” option and select an app. Here, we are going to mention a few user-recommended apps: Windows Notepad, WinRAR, Free File Viewer, Adobe Acrobat, Microsoft Office, and so on. Finally, you may try to drag the file to a browser so that you can open this.
On Mac:
To do so, you should first tap on the file. Then, you must tap on the “Open With” option and select a proper app. If you have not found any supported software, you need to find a free online DS_Store file opener.
Can you delete DS_Store files on Mac?
Deleting these files on Mac without losing any vital data is possible. However, there is a chance of reverting the folder appearance to the default preferences. Moreover, you can see a new empty Ds_Store file if you open the folder next time. Therefore, if you are unwilling to see them, you should hide them instead of deleting them.
How to hide DS_Store files on Mac?
If you want to hide these on your Mac, you should follow the steps:-
- Your first job is to open Finder.
- Then, you need to go to Applications.
- Then you have to head towards Utilities.
- Next, go to the option named Terminal.
- After that, you need to put the command: defaults write com.apple.finder AppleShowAllFiles FALSE and tap on Enter.
- You should use the earlier command to exit Finder.
- If you still get to see the file, you need to force quit the app. After that, you have to check whether it is hidden or not.
Are DS_Store Files Harmful?
These files are sometimes available in archives which you can receive from other Mac users. But remember that these files never cause harm if you get them in a folder. Generally, these files are hidden, but it is possible to enable their setting and see the files.
- If you want to enable the hidden files, you should choose Go and select the option Computer. Next, you should choose Macintosh HD so that you can expand the section.
- After that, you have to choose Command + Shift +. (the period key). Then, in your Mac operating system, you can see the hidden files, which will appear as greyed-out files.
- But if you upload this DS_Store file with other files to the Mac, you should know that these files may be misused to get information, including file attributes or metadata about files. As a result, hackers can perform malicious acts and see private files.
Reasons to Delete a DS_Store File:
Although the fact is that it is not harmful and does not consume enough space in a folder, but there are a few reasons due to which you need to delete the file.
- When Finder acts up to open a folder, these corrupted files do not allow you to change view options easily. Besides, these files prevent you from sorting the file icons within the folder.
- If a folder gets closed instantly, it indicates that this one is a sign of a corrupted file.
- You can delete them to reset the display preferences. In this case, you may lose custom Finder view settings for the specific folder. However, it is possible to change the settings or view options of the folder.
- You can face a few issues caused by the DS_Store files when you transfer files from Mac to another system.
How to delete it?
These are a few methods following which you can fix the issues caused by the files.
- Your first task is to use suitable apps for opening these files on non-macOS systems such as Windows. For example, you may use a few tools like WinRAR, Adobe Acrobat, and Free File Viewer to open these files in Windows.
- Now, you have to make sure that the file is not corrupted. Besides, ensure that malware or virus is not infecting the file. In this case, you should try running a malware scan with the help of the best antiviruses for Mac. If necessary, you should try to check for potential threats.
- You will not lose any data when you delete a file. But as soon as you change the folder preferences, Finder will help make a new DS_Store to store all the custom view settings.
However, we have given methods for deleting a DS_Store file for—
- A specific folder
- Multiple folders via the Terminal app on the Mac
How to Delete a DS_Store File for a Specific Folder:
You should go through these steps if you want to learn how to remove the ds_store file from Mac from a particular folder.
Step 1: Your first job is to choose the option named: Go. Then, you need to select the Utility option. After that, your task is to choose the option: Terminal. If you haven’t logged in as an administrator, you may have to put in your name and password to access the Terminal app. Next, you need to take the help of the commands for deleting the DS-Store files.
Step 2: Now, you have to locate the folder. Then, your task is to change the directory to the folder that contains the DS_Store file. For instance, if the folder is on the PC, then you need to use the cd desktop command. Next, you have to tap on Enter.
Step 3: You should type find . –name ‘.DS_Store’ –type f –delete so that you can delete all files in your current directory. Now, you should hit Enter. Ensure that you are typing the command exactly. Otherwise, you may lose other essential files on the Mac.
Step 4: Next, you have to choose OK. Then, .DS_Store files that are available in your chosen folder will get deleted. The terminal can send messages only when the entered command does not work.
How to Delete a DS_Store File for Multiple Folders:
First, you must follow the steps to delete all files from the Mac.
- Next, you should choose Go, then Utilities, and Terminal after that.
- Now, you have to put the following command in the Terminal window: sudo find / -name “.DS_Store” -depth -exec rm {} \; and hit Enter.
- Then, you need to put the password when prompted. Then, you can see that all the files are deleted from the folders. The application can only give you a return message when your entered command does not work.
How to Prevent Automatic Creation of DS_Store Files?
Developers & system administrators want to prevent security breaches via .DS_Store files. Remember that looking for the files in random folders on your server is not easy. Sometimes, you can leak any information unknowingly. If you find any, you should try to delete the file with the ‘rm.DS_Store’ command. Thus, you can fix the problem.
The simplest process through which you can resolve the error is to turn off the automatic creation of these files. You should follow the below-described steps to do so:
- Your first task is to hit command + spacebar. Then, you should look for Terminal.
- Now, you have to open the section Terminal. Now, you have to copy the given command and paste this:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
- Next, you should hit enter.
If you want to reverse this in the future if required, you should change true to false:
defaults write com.apple.desktopservices DSDontWriteNetworkStores false
- Once you run any command, you have to restart the device.
You should use Git to fix the error if you are a developer.
- You should place the DS_Store in the .gitignore file. Thus, it is possible to ignore this .DS_Store file.
How to Automatically Delete .DS_Store Files Periodically
Do you not want to delete the file manually? If so, you should use a UNIX command to remove files automatically at regular intervals. Here are the steps that you need to follow:-
- Your job is to choose Go. Then, you have to select Utilities and Terminal.
- Type the command in Terminal and paste this after that: sudo crontab -e and hit the Return key.
- If prompted, you should put in the administrator password.
- If you use vim editor, you should hit i on the keyboard. Next, you need to type the command and paste this: 30 10 * * * root find / -name “.DS_Store” -depth -exec rm {} \;
You can see the entry of the crontab in this format: <Minute> <Hour> <DayOfMonth> <Month> <DayOfWeek> <User Command>. If you want, use separate values to configure this command for another time. You can see the command running if the Mac is on or in Sleep mode.
- You should hit the Esc key on the keyboard, and after that, you need to hit Shift + Z + Z simultaneously so that you can save the crontab entry.
How to Fix the Ds_store File Issue:
We have given here a few fixes that can be followed for troubleshooting the Ds_store File Issue:-
Reason 1) MacOSX is not installed:
You need to double-click on the file. Once you do so, it will prompt you with the message “Windows 10 cannot open the ds_store file”. The error can appear if you don’t install the macOS X Finder for Windows 10. There is no need to double-click to open its typical path, as Windows 10 cannot set up a program connection.
Reason 2) MacOSX Finder version is wrong:
It may happen that, by chance, you have installed an outdated version of macOS X Finder, which does not support the macOS X folder setting file type. So, if you install the wrong version, you need to install the correct version. Mainly, macOS X Finder generates the macOS X folder settings files. This Finder is newer compared to the files which you have installed.
Although you install the correct version of macOS X Finder, you can face issues when you open the file. You may even encounter other problems which are not related directly to the software. These issues can prevent you from opening the DS_Store file.
The error messages are as follows:-
- Ds_store file reference error in the Windows registry.
- Incorrect deletion of Windows registry ds_store instructions.
- Invalid installation of ds_store -related programs (such as macOSX Finder).
- Ds_store itself is corrupted.
- Your ds_store is infected with malware.
- Ds_store -related hardware has outdated device drivers.
- Your computer does not have enough system resources to open the macOS folder and set the file format.
The Bottom Line:
In this article, we have elaborated on what is a ds_store file, how to open a .ds_store file on macOS, how you can delete the file, and so on. Besides, after checking the entire article, you will get to know how to delete them automatically. Still, if you have any queries, let us know via comments.
Frequently Asked Questions
- Can you delete .DS_Store files on Mac?
Mac Finder generates these files, due to which you will not lose any data when you delete the corrupted files. These files are generated to store viewing options like icons’ positions, the Finder window’s size, and window backgrounds. If you want to delete the .DS-Store file, you must use the Terminal.
- Why is the DS_Store file on Mac?
Mac OS X Finder generates these files automatically in browsed directories. You should know that you can get information regarding system configuration from these files.
- What does a DS file mean?
DS_Store stands for Desktop Services Store.