.DS_Store Files on Mac: What They Are and How to Delete Them
Every time you open a folder on macOS, upload data to the server, or transfer files to your colleagues, you might always see a file called “.DS_Store”. This tiny file records your viewing settings, such as icon positions, column widths, and background color, so that each folder looks exactly as you left it.
It can be annoying when thousands of .DS_Store files are scattered across your external drives. As the Finder creates the .DS_Store file as soon as you open a folder, detecting these files is like a temporary victory. The good news is that you can permanently stop this function on your Mac. In the following parts, we’ll learn how to delete DS_Store files and prevent new ones from appearing. With simple clicks, you don’t need to worry about them again.
What Is .DS_Store File?
The .DS_Store
file is a hidden metadata file automatically created by macOS Finder whenever you open a folder. It stores information about how that particular folder was displayed—such as icon positions, column widths, background color, sort order, and more—so that the next time you open it, everything appears exactly as you left it. It doesn’t contain the actual files or folders, only metadata about them.
Typically, it contains the following settings:
Category | Examples of what’s stored |
---|---|
Window geometry | Position on screen, width & height of the Finder window |
View mode | Icons, list, columns, Cover Flow, Gallery |
Sort order | By name, date, size, kind, tags |
Icon layout | X-Y coordinates of each icon, grid spacing |
Background | Solid color or image path for folder background |
Hidden-file flag | Whether hidden files are currently shown |
File comments | Spotlight comments entered in the “Get Info” panel for older macOS versions |
Custom toolbar & sidebar state | Which buttons or sidebar items were visible |
Why Does Mac Create .DS_Store Files?
macOS creates .DS_Store files for Finder to record and restore each folder’s appearance —window size, position, view mode, icon layout, sort order, background settings, and visibility flags. Whenever you reopen it, each folder would display how you left it. Accordingly, it wouldn’t need to customize the view every time.
Is It Okay to Delete .DS_Store Files?
Yes, it’s safe to delete .DS_Store files on your Mac. Removing them will neither damage macOS nor erase any of your actual data. The only effect is that the affected folder will revert to Finder’s default view settings, such as icon size, sort order, and background. The next time you open it, macOS will quietly create a new .DS_Store file if you rearrange that window.
That said, it’s generally unnecessary for most Mac users to delete these files, unless you’re troubleshooting Finder quirks or want to reduce clutter when sharing folders with other systems.
If your Mac is cluttered with unnecessary files, a Mac cleaner like BuhoCleaner can be a game-changer. It automatically scans your system for unwanted files, shows exactly how much space they occupy, and pinpoints their locations. Simply click Scan, review the results, select what you don’t need, and hit Remove. In just a few clicks, you can reclaim several gigabytes of storage and boost your Mac’s performance. Click the button below to try it now.
How to Delete .DS Store Files on Mac?
When transferring files between macOS and other systems like Windows or Linux, you might be puzzled by the appearance of unfamiliar .DS_Store files. To streamline your workflow and improve compatibility with other platforms, you can delete these files on your Mac. Similarly, if you want to reset folder display settings or fix issues with icon viewing or sorting in Finder, removing .DS_Store files can help.
In this section, we’ll introduce the methods for removing .DS_Store files on a Mac, step by step. You can delete them either manually or automatically.
Manually Delete .DS_Store Files on Your Mac
Terminal can help you delete .DS_Store files on your Mac. With a single “find
” command, you can easily clean them everywhere. However, it’s notable that the command only cleans the existing ones. macOS will recreate .DS_Store files the next time you open a folder in Finder.
Here is how to delete .DS_Store files on your Mac with Terminal:
- Navigate to Applications > Utilities > Terminal.
Enter the following command to remove all .DS_Store files on your Mac:
sudo find / -name ‘.DS_Store’ -type f -delete
- To target a specific folder instead of the whole system, replace / with its path. For example:
find ~/Downloads -name '.DS_Store' -type f -delete
. Repeat the command with different paths if you want to remove .DS_Store files from multiple folders separately.
Automatically Delete .DS_Store Files on Your Mac
If you don’t have time to delete .DS_Store files manually, you can configure Terminal to automatically delete them periodically on your Mac.
- Open Terminal and enter:
sudo crontab -e
. - Inside the vi editor, press i and paste:
30 12 * * * find / -name ".DS_Store" -type f -delete
. - The numbers mean 12:30 AM daily. Press Esc, and then Shift + Z + Z.
Can I Stop .DS_Store Files from Being Created?
You can’t stop Finder from creating .DS_Store files. macOS is hard-wired to write them whenever you change the view options of a folder. What you can do is to keep Finder from reading them. By doing so, they'll stay out of your sight. Technically, you can hide them from your eyes.
- To prevent Finder from using .DS_Store on network volumes, paste the following command into Terminal, and reboot:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
- To hide them from your view everywhere else:
defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder
FAQs about .DS_Store Files on Mac
By the end of the post, we’ll further explore common FAQs about .DS_Store files on Mac.
Are .DS_Store files a security risk?
It can also lead to potential security risks. If they are running on a web server, they may expose directory structures and filenames, which may assist attackers. But you can cut this by:
- Ignoring .DS_Store in deployments using .gitignore.
- Blocking through server rules (like .htaccess with Apache).
Why can’t I see .DS_Store files even with hidden files enabled?
macOS makes them “super-invisible”. You cannot even show them up by typing Command + Shift + Period buttons. To view them, you need to use Terminal.
Can I delete .DS_Store files on Windows?
Yes. You can erase them with any standard delete method, such as File Explorer, Command Prompt, or PowerShell. This won’t affect other applications on your computer.
Here's how to delete DS_Store files on Windows using File Explorer:
- Open File Explorer, click in the search box, type .DS_Store and press Enter.
- When Windows lists the corresponding files, press Ctrl + A to select them all.
- Hit Shift and Delete to remove all .DS_Store files from the selected location.
Clare Phang has been captivated by the world of Apple products since the launch of the iconic iPhone in 2007. With a wealth of experience, Clare is your go-to source for iPhone, iPad, Mac, and all things Apple.