A .DS_Store file is a hidden folder your Mac creates automatically to remember how you like to view folders

The ".DS_Store" stands for "Desktop Services Store." Every time you open a folder on a Mac, the operating system records details about that folder — things like the size of the window, which files you had selected, whether you were looking at a list or icons, and where you scrolled to. It saves all of this in a hidden file called .DS_Store so that the next time you open that same folder, it looks exactly the way you left it.

This file is created automatically by macOS and you do not need to do anything to make it appear. It sits invisibly in almost every folder on your Mac. The reason you might notice it is usually because you have connected an external drive to a Windows computer, or shared files with someone using Windows — when that happens, the .DS_Store file becomes visible to them, and it can look like clutter or a mysterious system file.

The file itself is harmless. It takes up very little space (usually a few kilobytes) and does not affect how your computer runs. You can delete it without breaking anything, though macOS will straightforward create a new one the next time you adjust how a folder looks.

Key Takeaways

  • .DS_Store files are created by macOS to remember your folder view preferences, like window size and icon arrangement.
  • These files are hidden on Mac computers by default, so most users never see them unless they turn on viewing hidden files.
  • The files become visible to Windows users when you share an external drive or folder, which can make them appear as unwanted clutter.
  • Deleting a .DS_Store file is safe and causes no problems — macOS will create a new one automatically when needed.

Why you see .DS_Store on external drives and shared folders

When you plug an external hard drive into your Mac and browse its folders, macOS creates .DS_Store files on that drive just as it does on your internal hard drive. If you then connect that same external drive to a Windows computer, Windows shows you all the files — including the hidden .DS_Store files — because Windows does not recognize the Mac "hidden" flag.

The same thing happens when you share a folder over a network or upload files to a shared cloud service. Your Mac creates .DS_Store files in those locations, and anyone using Windows or viewing the files through a web interface will see them. This is why you might notice .DS_Store appearing in shared project folders or on USB drives you have used on both Mac and Windows machines.

From a Windows user's perspective, these files look like system clutter. They are not — they are just Mac housekeeping files that have no meaning on Windows. But they do take up a tiny amount of storage space and can make a folder listing look messier than it should.

How to delete .DS_Store files

If you want to remove .DS_Store files from an external drive or shared folder, you have a few options. The simplest is to delete them manually: turn on viewing hidden files on your Mac (in Finder, press Command+Shift+Period), find the .DS_Store files, and drag them to the trash. They will be gone when ready.

If you have many folders and want to remove all .DS_Store files at once, you can use the Terminal process. Open Terminal (found in Applications > Utilities) and type: find /Volumes/DriveName -name ".DS_Store" -delete, replacing "DriveName" with the actual name of your external drive. This command searches through every folder and deletes every .DS_Store file it finds. Be careful to type the command exactly — Terminal does not ask for confirmation before deleting.

After you delete them, new .DS_Store files will be created the next time you adjust how those folders look on your Mac. This is normal and expected. If you want to prevent .DS_Store files from being created on external drives altogether, you can use Terminal to disable the feature, though this requires typing a command each time you connect a new drive.

The difference between .DS_Store and other hidden Mac files

macOS creates several types of hidden files and folders, and .DS_Store is just one of them. Other common hidden files include .git (used by programmers), .env (configuration files), and folders like .cache and .config (where programs store settings). All of these start with a period, which is the Mac convention for "hide this from normal view."

The .DS_Store file is unique because it is created in every single folder, whereas most other hidden files are only in specific locations. It is also the one most likely to cause confusion when Mac users share files with Windows users, because it appears in every shared folder.

If you are working with files that will be shared across different operating systems, you might want to delete .DS_Store files before sharing them. Some teams add .DS_Store to a .gitignore file (a list of files to ignore) so that the files are never uploaded to shared code repositories in the first place.

When you should and should not delete .DS_Store files

It is safe to delete .DS_Store files at any time. Deleting them will not affect your Mac's performance, will not cause any programs to stop working, and will not lose any of your actual data. The only consequence is that the next time you open that folder, it will look like a fresh folder — your window size and view preferences will be reset to the default.

You should delete .DS_Store files before sharing folders with Windows users or uploading files to shared services where the files will be visible to others. This keeps the shared space cleaner and prevents confusion about what the files are.

You do not need to delete them if you are only using your Mac by yourself. They are not taking up meaningful space, and they are hidden by default, so you will not see them. Leaving them alone means your folder view preferences will be preserved exactly as you set them.

Frequently Asked Questions

Is .DS_Store a virus or malware?

No. .DS_Store is a legitimate system file created by macOS. It contains only information about how you view folders — window size, icon positions, and scroll location. It cannot harm your computer or steal data. If you see warnings online claiming .DS_Store is dangerous, those warnings are incorrect.

Why does my Mac create .DS_Store on USB drives but not on network folders?

Your Mac creates .DS_Store on any storage location it can write to, including USB drives, external hard drives, and some network folders. On some network locations or cloud services, the system may not have permission to create new files, so .DS_Store is not created. This depends on how the network location is configured.

Can I prevent .DS_Store files from being created?

Yes, but it requires using Terminal and the command must be run for each drive. You can type: defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true to prevent .DS_Store on network drives specifically. Disabling it entirely is possible but not recommended, as it removes a useful feature.

What happens if I delete .DS_Store while a folder is open?

Nothing harmful happens. If you delete the .DS_Store file while the folder is open in Finder, macOS will straightforward create a new one when you close and reopen the folder. Your current view settings will be lost, but the folder will continue to work normally.

Do I need to delete .DS_Store before uploading files to cloud storage?

It depends on the service. If you are uploading to a shared folder where other people will see the file list, deleting .DS_Store first keeps things cleaner. If you are uploading to personal cloud storage like iCloud Drive, the .DS_Store files are harmless and will be hidden from other users anyway.