.DS_Store Removal permanent way of stopping it's creation on Mojave

As a developer, I'm routinely making folders on my Mac running Mojave for testing purposes, my localhost server or for transfer to VPS or other hosting. In principal I'd rather not have .DS_Store altogether, but if the computer wants to have them, I don't mind.

However, is there a way to permanently stop them from being created in a particular dir and subdirs?

I'm aware you can configure no .DS_Store files across the board on network shares, but I need to be more selective than an all or none solution. Ideally I can suppress these both on local filesystems as well as remote, but if anyone can help with preventing some of these and allowing others, I would be grateful.

This question is to address Mojave and newer OS only and to address a more fine grained control or to confirm that this is impossible.


There's no built-in functionality in macOS to stop the creation of .DS_Store files in a specific folder and its subfolders. There's a setting to stop the creation on networked volumes (i.e. folders that really are network shares).

You can download a third party utility called "DeathToDSStore" from here:

https://github.com/snielsen/DeathToDSStore

This will stop the generation of .DS_Store files in general, but still not for a specific directory.

You mention that you are a developer - thus it might be possible for you to modify that utility to do exactly what you want. The utility is open source. You can find the specific place to override in the file source/FinderOverride.m.

In the comments you've mentioned needing to run on Mojave, which DeathToDSStore doesn't support yet. On Mojave you can run this fork of Asepsis that is compatible with Mojave:

https://github.com/JK3Y/asepsis