A .DS_Store file is a hidden folder created by macOS that stores display settings for how a folder should look
Every time you open a folder on a Mac, the operating system creates a file called .DS_Store (Desktop Services Store) in that folder. This file remembers things like the size of the window, the position of icons, which files were selected, and the background image. The next time you open that folder, macOS reads the .DS_Store file to restore those exact settings.
The file is hidden by default, so you won't see it in Finder unless you turn on the option to show hidden files. It's small — usually between 4 and 16 kilobytes — and it exists only on macOS. If you copy a folder from a Mac to a Windows computer or a Linux machine, the .DS_Store file comes along but serves no purpose on those systems.
These files accumulate over time because macOS creates one in every folder you browse. On an external drive or a network folder shared between Mac users, you may see many .DS_Store files stacked up, one in each directory.
Key Takeaways
- .DS_Store files are created automatically by macOS to remember folder display settings and do not need to be deleted for your computer to run smoothly.
- These files are hidden by default and take up minimal disk space, so they rarely cause performance problems on their own.
- You may notice .DS_Store files on external drives or shared folders, where they accumulate across many directories.
- Removing .DS_Store files is safe and will not harm your Mac, though they will be recreated the next time you browse those folders.
Why .DS_Store files exist and what they store
macOS uses .DS_Store files to preserve your folder preferences. When you resize a Finder window, change the view from icons to a list, or sort files by date, macOS saves those choices in the .DS_Store file. This means the next time you open that folder, it looks exactly as you left it — the window opens at the same size, in the same view, with the same sort order.
The file also stores metadata about the folder itself, such as the position of the folder icon in the parent directory and any custom background image you've set. For folders on your desktop, the .DS_Store file can be larger because it may contain thumbnail previews of the files inside.
This system works silently in the background. You never interact with the .DS_Store file directly; macOS handles it automatically. The file is named with a leading dot (.) because in Unix-based systems — which macOS is built on — files starting with a dot are treated as hidden by default.
Do .DS_Store files slow down your Mac
No. .DS_Store files do not noticeably affect your Mac's performance. Each file is tiny, and even if you have hundreds of them across your drives, they consume only a few megabytes of total disk space. Your Mac's speed depends on factors like available RAM, processor load, and how full your main drive is — not on the presence of hidden .DS_Store files.
The only scenario where .DS_Store files might matter is if you're trying to maximize available space on a very small drive, such as an older external hard drive with limited capacity. Even then, deleting them would free up only a negligible amount of room.
If your Mac is running slowly, the cause is almost never .DS_Store files. Look instead at how much free space remains on your main drive, how many browser tabs and applications are open, or whether your drive is nearly full.
Where .DS_Store files appear and why you might see them
You'll encounter .DS_Store files most often on external drives, USB flash drives, and network-shared folders. When you browse these locations on your Mac, macOS creates a .DS_Store file in each folder you open, just as it does on your internal drive. If multiple people use the same external drive or shared folder, multiple .DS_Store files accumulate.
You might also see .DS_Store files appear in cloud storage folders like iCloud Drive or Dropbox if you access those folders from a Mac. The files sync to the cloud along with your other data, which can clutter the folder view on other devices or when you access the folder from a Windows computer.
On a Windows or Linux computer, .DS_Store files are straightforward ignored — they don't cause errors, but they do take up a small amount of space. Some people remove them from shared folders to keep things tidy, though it's not necessary for the folder to function.
How to view hidden .DS_Store files on your Mac
By default, .DS_Store files are hidden. To see them in Finder, you need to enable the option to show hidden files. The quickest way is to press Command + Shift + Period (the period key). This keyboard shortcut toggles hidden files on and off when ready.
When you press the shortcut, all hidden files and folders on your Mac become visible, including .DS_Store files, .git folders, and system configuration files. Press the same shortcut again to hide them. The setting applies to all Finder windows until you toggle it off.
If you prefer a menu option, open Finder, click View in the menu bar, and look for an option like Show Hidden Files or Show All Files. The exact wording varies by macOS version, but the result is the same.
How to delete .DS_Store files safely
Deleting .DS_Store files is completely safe. They will not harm your Mac, and you can remove them without worry. The simplest way is to select a .DS_Store file in Finder and press Command + Delete, or right-click and choose Move to Trash. Empty the Trash afterward, and the file is gone.
If you want to delete .DS_Store files from a specific folder and all its subfolders, you can use the Terminal. Open Terminal (found in Applications > Utilities), then type the command find /path/to/folder -name ".DS_Store" -delete, replacing "/path/to/folder" with the actual folder path. This removes all .DS_Store files in that directory tree at once.
Keep in mind that macOS will recreate .DS_Store files the next time you browse those folders. If you delete them from an external drive, they'll reappear once you open folders on that drive again from your Mac. This is normal and expected behavior.
Preventing .DS_Store files on external drives and shared folders
You can prevent macOS from creating .DS_Store files on external drives and network volumes by disabling the setting in System Preferences. Open System Settings (or System Preferences on older macOS versions), go to General, then look for an option related to .DS_Store files or folder metadata. Not all macOS versions expose this setting in the GUI, so it may not be available on your system.
An alternative is to use Terminal to disable .DS_Store creation globally. Open Terminal and type defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true. This command prevents macOS from writing .DS_Store files to network volumes and external drives, though it does not affect your internal drive.
Some people use automated scripts or third-party tools to periodically clean up .DS_Store files, but this is rarely necessary unless you share drives frequently with Windows users or need to keep folders extremely tidy.
Frequently Asked Questions
Is .DS_Store a virus or malware?
No. .DS_Store is a legitimate system file created by macOS. It contains only folder display settings and poses no security risk. Antivirus software will not flag it as a threat because it is not one.
Why do .DS_Store files appear on my external drive when I use it on Windows?
Windows does not create or use .DS_Store files, so any .DS_Store files on your external drive were created by a Mac. Windows straightforward ignores them. You can delete them on Windows without affecting the drive's function, though they will reappear if you browse folders on that drive using a Mac again.
Can I delete all .DS_Store files on my Mac without problems?
Yes, you can safely delete all .DS_Store files on your Mac. The only consequence is that folder display settings will reset to defaults the next time you open those folders. macOS will then create new .DS_Store files with your current preferences.
Do .DS_Store files take up a lot of disk space?
No. Even if you have thousands of .DS_Store files across your Mac, they typically consume only a few megabytes total. Deleting them will not noticeably increase your available storage unless your drive is extremely full.
What happens if I disable .DS_Store creation on my Mac?
If you disable .DS_Store creation, macOS will not remember your folder preferences between sessions. Each time you open a folder, it will appear in the default view and size. Your Mac will function normally otherwise, and there are no performance benefits to disabling it.