[macos] How to stop creating .DS_Store on Mac?

I'm developing sites on mac and every time I create some folder (or file in that folder) .DS_Store is created in that folder.

How to prevent creating .DS_Store file ?

This question is related to macos

The answer is


Its is possible by using mach_inject. Take a look at Death to .DS_Store

I found that overriding HFSPlusPropertyStore::FlushChanges() with a function that simply did nothing, successfully prevented the creation of .DS_Store files on both Snow Leopard and Lion.

DeathToDSStore source code

NOTE: On 10.11 you can not inject code into system apps.


If you want the .DS_Store files to become invisible (they still exist but can't be seen) then run the following command in the "Terminal" window:

defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder

This will set the system default to stop showing these files on your Desktop and elsewhere. It will also restart the Finder in order to make this change visible (especially on your Desktop).


this file starts to appear when you choose the system shows you the hidden files: $defaults write com.apple.finder AppleShowAllFiles TRUE If you run this command disapear $defaults write com.apple.finder AppleShowAllFiles FALSE Use terminal


the function

find ~/ -name '.DS_Store' -delete

, removed the .DS store files temporarily. But am not sure , whether the files will came back on the Mac. Also i noticed something peculiar, the "DS_Store" start coming to the Mac after installing 'ATOM'. So guys please make it sure to scan properly your third party software before installing them. Best


Please install http://asepsis.binaryage.com/ and then reboot your mac.

ASEPSIS redirect all .DS_Store on your mac to /usr/local/.dscage

After that, You could delete recursively all .DS_Store from your mac.

find ~ -name ".DS_Store" -delete
or
find <your path> -name ".DS_Store" -delete

You should repeat procedure after each Mac major update.


Open Terminal. Execute this command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Either restart the computer or log out and back in to the user account.

for more informations:

http://support.apple.com/kb/ht1629


Put following line into your ".profile" file.

Open .profile file and copy this line

find ~/ -name '.DS_Store' -delete

When you open terminal window it will automatically delete your .DS_Store file for you.


NOTE: "Asepsis is no longer under active development and supported under OS X 10.11 (El Capitan) and later."


Here's a comprehensive review of your options. Asepsis (the second solution mentioned) seems to be what you're looking for, it re-routes .DS_Store creation to a unified cache instead of being located on every folder.