Until a little while ago the .DS_Store file was well hidden from my eyes. During my daily work process, I started to realize this DS_Store file was appearing almost everywhere. Soon its presence became a question of its occurrence and need. I tried opening this strange file but couldn’t do so.
When I tried to open the DS_Store file I was presented with an error saying, “There is no application set to open the document “.DS_Store”.
My overall experience with DS_Store file made me scratch my head and dig deep into its occurrence & behaviour.
.DS_Store file? What – Why – Where – How?
What is a .DS_Store file?
It expands to Desktop Services Store and is a hidden file that holds crucial information regarding a folder. Even things like the Mac desktop and all its volumes, external drives, etc, all are treated as a folder.
With its common occurrence overall, a common question arises, why is the .DS_Store file present everywhere and what is its importance to OS X or you?
The .DS_Store file is there to hold folders icon information, settings, thumbnail and background image information. DS_Store is a metadata file for a respective folder. A single DS_Store file is well placed and can be located when a user navigates through different partitions, folders & sub-folders on Mac OS X.
You will even find DS_Store files on remote computers; that is, if the Mac is shared through the network. Even when you plug an external drive into your Mac it will create a DS_Store file.
It’s not just Macs that utilize this method. If you have been a PC user then you may have come across the Thumbs.db file. The DS_Store is similar to Thumbs.db on a Windows computer.
.DS_Store file is a hidden OS X file that won’t reveal until you unhide the files on system. You can unhide all the files on OS X using the terminal command:
defaults write com.apple.Finder AppleShowAllFiles YES
Hit return and type:
killall Finder
This command will result in revealing all hidden files on the desktop, connected volumes and other folders.
.DS_Store can not be permanently trashed.
Even if you move this file to trash and proceed with ‘Empty trash‘ it will reappear again in its original location. Also, keep in mind that Apple purposely made these files hidden just to ensure the OS X run uninterruptedly. Any other hidden file trashed may cripple an application software or can cause serious logical corruption to OS X Mac. So, be very cautious and don’t mess with these hidden files unless you are absolutely positive what you are doing.
Where does .DS_Store file get created?
- On a Flash drive
- USB HDD
- Network Volumes
- Remote Systems
The DS_Store file can be seen when above mentioned devices are connected or mounted with the Mac OS X. As we know now, every device is a considered folder on Mac, the Finder creates this DS_Store file when the OS X detects an external media.
Is there a need to remove .DS_Store file from Mac OS X?
No, if you are a Mac user then there is no need to find tricks & tips to permanently remove the DS_Store file.
This file consumes negligible space on the Macintosh hard drive. Just look at the screenshot that I took from my desktop. I believe a file the size of 25 KB is of no concern for a Mac OS X user. I also checked the file size on my OS drive, which was only 29 KB.
The best thing to do is just leave the file alone. The best way to do that is just set it back to the default setting of being hidden from sight.
If your hidden files aren’t already hidden:
Open terminal
Type:
defaults write com.apple.Finder AppleShowAllFiles No
Hit Return
Type:
KillAll Finder
Hit Return
While I agree that one .DS_Store is negligible in size I don’t think you’ve realized that there is a .DS_Store for every directory in your hard drive, external drive you connect to your computer and every shared network drive you decide to connect with your MAC.
So if counted all the directories on your drive (off the top of my head …. find / -type d | wc -l ) and then multiplied that by 29kb you might find its taking up a bit more space than you thought. Not to mention every directory of every external device and every network drive you’ve connected your MAC to.
I accidentally revealed all of my hidden files a little while ago and was having trouble figuring out how to hide them again (sure they’re useful to the mac itself, but I don’t need to see them!). Luckily this article showed me how to hide them again – although I have to admit, typing in ‘KillAll’ made me a bit nervous XD
Glad it helped you out :)
Thank u so much !! I was pissed off with this DS STORE !
Thanks for the great explanation, its gotten me a bit close to understanding how .ds_store files behave. I’m trying to pinpoint the exact reason why a .ds_store file would get created in a local folder I’ve created.
It seems to me that a newly created folder with no contents, or with the original content added into the folder, does not trigger the creation of a .ds_store file.
However, moving a file from that folder to the trash, or to another folder, (desktop, other directories, etc), or overwriting a file within that folder, causes the creation of of .ds_store file.
Also, when deleting a file from a folder, the file seems to sometimes be “in use” by the system, as I cannot remove it from the trash on occasion.
Can you shed any light on what scenarios actually cause the creation of a .ds_store file in a local directory? Thanks in advance for any insight!
The .DS_Store files might not be large, but they are really annoying for shell users who want to quickly tab into a deep directory hierarchy.
Number of files, the space they occupy, the annoyance for shell users… these are small issues – compared to this:
The *major* problem with the fact that Finder creates these files it that it has a side effect.
Namely, when a .DS_Store file gets created (uninvitedly as we know), the directory gets changed (!!!) (right?). And in the *nix it means that a certain flag called “modification time” gets updated to the current time (!!!).
So: if history, time, order makes sense to you (say if you want to sort your folders by modification time, which I personally do all the time) you are screwed.
To demonstrate: open a Finder window, go to a folder with a bunch of sub-folders in it,
sort them by time ( if you don’t know how: choose the list view (“View”/”as list”, click on the “Date Modified” column (or “View” / “Arrange by” / “Date modified”), — Ok, your folders are in some meaningful order now, right? — now, double-click on some folder in the middle of your view and go back: the folder will bump up to the top of the list.
The meaningful information about this folder was just lost.