Each time your Mac connects to a Windows computer, it leaves something behind – a .DS_Store file. This very short guide will show you how to stop that from happening.
Background
DS_Store files are created in every folder on your Mac. They contain information about that folder, like the position of icons or the way you want files displayed specific to that folder. Since its purpose is to help macOS itself (not you as the user) they’re “hidden” – by starting the file name with a dot (.) If you’d like more detailed information on .DS_Store files, see this Wikipedia article.
The “problem” with those files is that your Mac will create them when you connect to Windows computers as well, and on Windows, those files aren’t hidden. Fortunately, you can stop your Mac from creating them when you’re connected to a Windows computer.
Disable .DS_Store Files on Windows
- Open a Terminal by navigating to Applications -> Utilities -> Terminal. Copy and paste the command displayed below into your Terminal and hit enter.
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
- Now just sign out of your Mac and back in again (or restart your Mac). From now on when you connect to Windows drives you won’t leave a .DS_Store file behind :)
- That’s it!
- Note: .DS_Store Files on Windows are not created when you use something like Remote Desktop from your Mac to a PC, only when you connect via SMB.