You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Junk files created by macOS (or Finder)...

Good day guys,


I know this has been asked several times in the past, and there hasn't been a proper solution for this till now. As is typical of Apple, they don't give a **** despite several people complaining.


The issue is with macOS (or is it Finder?) creating several hidden files (._*, ._.*, .fseventsd, .spotlight-v100, .TemporaryItems, .Trashes, ._DS_Store, etc.) on removable and network volumes. These files not only drastically increase the number of files in those volumes, but also slow them down when accessed using other Operating Systems/ programs as they begin to index all those files in their own ways. Basically, a mess that is unnecessary with no built in tool/ setting to stop creating them.


There are several workarounds posted in forums, involving automator scripts, terminal commands, 3rd party apps, etc. But these are all temporary solutions 'after the fact', which means they all tend to delete these temp files after they are created. What this means is this is a never ending process, where macOS keeps creating them, and then one has to use one of the above solutions on a continuous basis and keep deleting them.


Here are my questions:


  1. What is creating these files? If it is Finder (and not macOS), will I stop seeing them by using another File Manager (instead of Finder)?
  2. When are these files created? Are they created only when a file operation (like copy/ move/ paste) is performed, or are they created the moment a volume/ folder is accessed using Finder?
  3. I have a NAS that I access using multiple devices running on multiple other platforms (Windows/ Android) and so I don't want this clutter. Besides, I guess these files also put a stress on my NAS as applications like Plex begins to index all these files, and I am not aware of a way to stop those from being indexed.
  4. I have found only one app BlueHarvest that can delete those files from network volumes (there are others too like USBClean, CleanUSBDrive, DotCleaner, etc. but those don't support network volumes). But as I mentioned before, these work 'after the fact' and I really want to avoid a continuous ongoing process like this. Besides, there are other concerns too like giving network admin access to these 3rd party apps in order to be able to do the task, another thing that I am not comfortable doing.


Is there a new efficient solution for this in 2020?


Thanks.


MacBook Pro

Catalina 10.15.5

MacBook Pro 13″, macOS 10.15

Posted on Jun 4, 2020 1:58 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 4, 2020 12:48 PM

You can turn off .DS_Store files if you like and Finder won't save view preferences on those drives.


For USB drives, execute the following in Terminal

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true


For Network drives,

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true



You can disable MDS on a specific volume, but you need to create a hidden file to do it

sudo touch /Volumes/{drive name}/.metadata_never_index


Some of the rest of the files are just a function of HFS+. If you format your thumbdrive as exFAT or NTFS they won't be created. The ._{filename} is the resource fork on your file. All files in macOS have that fork and that's how it tries to serialize them to disks with a different file system.


I don't know your use case, but if you have an HFS file system driver on Windows or Linux they usually reintegrate all of this so you can't see the details. I use Paragon on Windows for APFS and HFS drives and they look the same on my Windows machine as my Mac. My Synology NAS handles them all too so I don't seem on the Windows side when I mount the same share.


Not sure about Android, no experience there.


Similar questions

7 replies
Question marked as Top-ranking reply

Jun 4, 2020 12:48 PM in response to Sridhar Ananthanarayanan

You can turn off .DS_Store files if you like and Finder won't save view preferences on those drives.


For USB drives, execute the following in Terminal

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true


For Network drives,

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true



You can disable MDS on a specific volume, but you need to create a hidden file to do it

sudo touch /Volumes/{drive name}/.metadata_never_index


Some of the rest of the files are just a function of HFS+. If you format your thumbdrive as exFAT or NTFS they won't be created. The ._{filename} is the resource fork on your file. All files in macOS have that fork and that's how it tries to serialize them to disks with a different file system.


I don't know your use case, but if you have an HFS file system driver on Windows or Linux they usually reintegrate all of this so you can't see the details. I use Paragon on Windows for APFS and HFS drives and they look the same on my Windows machine as my Mac. My Synology NAS handles them all too so I don't seem on the Windows side when I mount the same share.


Not sure about Android, no experience there.


Jun 4, 2020 12:05 PM in response to Sridhar Ananthanarayanan

  1. Finder. Yes, but…

Spotlight does its own thing. If you exclude, the exclusion is stored inside the .SpotlightV100 folder, so if you delete that, so goes the exclusion.

.Trash is the trash for that volume. Not sure if that only gets created when you trash something or not.

.fseventsd is the File System Events database. It tracks every file system activity. Spotlight and Time Machine use it to keep up their little bits of the OS.


2. Depends on which file.

DS_Store is the folder display options from Finder. If you never open the folder in Finder, it won't create the DS_Store.


Dot underbar files are the metadata which on a macOS file system is part of the file (search AppleDouble, resource fork). When you copy the file to a file system incapable of handling the embedded metadata, the OS splits it off into the ._ file. If you copy it back to a Mac file system, it will put the two back together.

The dot_clean utility can remove those, but that is just the underlying unix utility that the GUI apps you mentioned use to remove them.


BlueHarvest used to be able to prevent writing of those files. But, that knowledge is from decades ago, so it may not work that way anymore.


I always wondered why NAS file system developers and car audio system developers can't figure out how to ignore them. Unix has ignored them for about half a century.

Jun 5, 2020 3:32 AM in response to TwistedNexus

Thanks for the terminal commands.


I'll try them out. Are these commands a one time thing and applicable to all removable and network volumes, or do they have to be configured individually?


My USB drive is exFAT formatted so I can use them on both my Windows laptop and Mac. And these files are created in it. My NAS is from WD My Cloud, and I think it is Unix based. But these files do show up when I access them using my Windows laptop or Android phone.

Jun 5, 2020 6:31 AM in response to Sridhar Ananthanarayanan

The defaults commands are a one time thing applicable to all drives that connect to your machine.


The hidden file needs to be added once per drive but as long as you don’t delete the file it will Keep working indefinitely.


You will see the ._ files when you use a non Apple file system. Those are the resource forks of the files. One alternative is to use HFS or APFS on your external drives. Another might be to use an alternative file browser as I think you mentioned.


If you want to get technical... on a drive with an Apple filesystem (HFS or APFS) every file has a data fork and a resource fork. When you copy a file to a drive with a different format, it persists the file the best it can. That’s where the ._ files come from. Back in the System 9 days and earlier they were used extensively. Wikipedia has a really good write up if you’d like to know more about them. Look up “Resource Fork”.

Jun 5, 2020 3:27 AM in response to Barney-15E

As always, thanks very much for helping out.


Although I like the simplicity of stock file managers (on both Windows and Mac), I can live with using a 3rd party file manager just when accessing removable and network volumes. So are you basically confirming I will stop seeing most of those files if I don't access these volumes using Finder?


As with Spotlight, I have requested it with a 'please' by adding my network volume to the exclusion list under System Preferences. I hope my request would be honoured.


As with Apple Doubles, I really don't know what additional metadata they contain. Because whatever matters, is already in the actual file and the same is read properly by all other OS and apps. I just did a search for such files on my Windows laptop and I found over 47k files! Unbelievable, although they added to just a couple of hundred MBs. But the sheer number of these files is extremely annoying.


So can we conclude that a couple of terminal commands, Spotlight exclusion and not using Finder (but using a 3rd party file manager) when accessing removable and network volumes will ensure that such files will mostly, if not completely, stop being created?

Jun 23, 2020 1:40 AM in response to TwistedNexus

Thanks for the explanations.


I do realize these files hold some information, but practically speaking, the main file holds all the info that really matter. Everything works just fine even after deleting those resource files.


So it wouldn't be incorrect to say that they are much more useless than being useful.


All that said, I think i am going to do away with Plex, another extremely resource hungry program that I actually don't need. For my usage, Plex (and similar programs) is extremely taxing on the NAS, for little value in return. I will stick with the traditional way of keeping everything simple, and use a file manager instead.


Simplicity and lightweight solutions are the way to go!

Junk files created by macOS (or Finder)...

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.