How to Disable .DS_Store Files and reclaim your Mac’s storage space
There’s no reason to waste storage space on your computer hard drive by allowing the creation of .DS_Store files in each folder on your Mac. These small files contain information about folders and can be deleted, but they tend to accumulate quickly and eat up important room on your computer. This short guide will show you how to disable the creation of .DS_Store files from happening automatically and reclaim some space on your hard drive at the same time.
What are .DS_Store files?
.DS_Store files are a hidden folder that the Finder creates on Mac systems. It appears in many folders throughout the OS, including on desktop directories. The issue with these files is that they will continually be created even when you delete them, adding more clutter to an already messy system. Thankfully, it is possible to disable the creation of these files using terminal commands with a little know-how.
To do this, one must first make their way into their Terminal directory which can be found in /Applications/Utilities/ or by typing terminal into Spotlight search followed by pressing Enter. Once there, type sudo chflags nonhidden ~/Desktop then press Enter. That command prevents the .DS_Store file from being created for any future icons added to the Desktop. Next, repeat the process but replace ~Desktop with another location like /Users/UserName/.DS_Store. Press enters after each command so that each one executes fully before going onto the next. Once the commands have been completed, it should take care of both those pesky Finder creations. If anything goes wrong, use the simple undoing method: sudo chflags noschg ~/Desktop
After following these steps, we were able to reclaim approximately 2 GBs worth of hard drive space!
Where do these files appear?
.DS_Store files appear in every folder that has a Finder window open on a Mac. When users browse through their files, each folder will have an accompanying file extension – like filename.docx.DS_Store – that helps keep metadata about the folder on hand at all times. The problem with these pesky files is not in their existence, but in their overwhelming abundance. Most users don’t even know what they are or what they do, which may lead them to mistakenly believe they are deleting necessary data when they remove the extension from their computer trash bin. If you’re still unsure of what these files are, there’s a nifty little free app called Delete .
DS_Store by Julien Schmidt that provides real-time feedback for how much hard drive space you’ve reclaimed after removing it. You can also manually delete the files by typing finder and clicking go into Terminal then type xattr -dr com.apple.FinderInfo & press enter then type xattr -d com.apple.FinderInfo & press enter. From there, drag and drop the folders with .
DS_Store extensions out of Finder and place them back in their respective locations for more selective deletion. I personally recommend running this process a few times over as some people report problems when trying to delete too many at once. It should be noted that while most Macs will benefit from this fix, those who use Spaces may need to turn off Show invisible files before proceeding. As always, make sure to back up your work before making any changes just in case something goes wrong!
Why should I care about them?
.DS_Store files store information about how a folder is supposed to be laid out, making it a necessary part of the folder structure. However, these files can take up a significant amount of hard drive space because they never actually change. In OS X, there are two steps you can take in order to stop these files from getting created:
1) Change the permissions of that particular folder by using Get Info from the Finder menu bar. By clicking on an extended button at the bottom left-hand corner with an arrow next to it, you will be able to set who has permission for accessing this folder.
2) If this doesn’t work or if you’re just too lazy to do anything, open Terminal and type chflags uchg path-to-folder. You’ll have to enter your password, but once you’ve done so all users will be prevented from creating new .DS_Store files in that folder.
How do I disable them?
Quit Finder. App or open another Finder window. On the File menu, click New Finder Window. The folder will open in a new window. In the new window, right-click on the desired folder and select Show Package Contents from the contextual menu that appears on your screen. In the directory you just accessed, navigate to System > Library > Core Services > , then copy this file to your desktop by dragging it into place with your mouse cursor over top of an empty space on your desktop pane.
Are there any alternatives?
There are two ways to disable the creation of .DS_Store files for a user’s folders. The first is by setting a keystroke in the keyboard system preferences, which will open Finder with a new search bar. This can be done by holding down control-command at the same time on one’s keyboard. When entering this shortcut combo into an empty search bar, it will create a new folder where one can type any website address or URL into in order to view that specific site or file from Finder.