How to stop creating .DS_Store on Mac?

Macos

Macos Problem Overview


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 ?

Macos Solutions


Solution 1 - Macos

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 recursively delete 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 major Mac update.

Solution 2 - Macos

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.

Solution 3 - Macos

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.

Solution 4 - Macos

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:

https://support.apple.com/en-us/HT208209

Solution 5 - Macos

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.

Solution 6 - Macos

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

Solution 7 - Macos

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

Solution 8 - Macos

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).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioniWizardView Question on Stackoverflow
Solution 1 - MacosCristian FlorescuView Answer on Stackoverflow
Solution 2 - Macosmichel-slmView Answer on Stackoverflow
Solution 3 - MacosParag BafnaView Answer on Stackoverflow
Solution 4 - Macosuser3817989View Answer on Stackoverflow
Solution 5 - MacosShanakaView Answer on Stackoverflow
Solution 6 - MacosDgoncalvesView Answer on Stackoverflow
Solution 7 - MacosSwapView Answer on Stackoverflow
Solution 8 - MacosEdward GrabczewskiView Answer on Stackoverflow