Can I stop .DS_Store files being created in certain folders? [duplicate]
Solution 1:
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