The command: ```bash defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true ``` is a macOS Terminal...
The command:
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
is a macOS Terminal command that modifies system preferences to prevent macOS Finder from creating .DS_Store
files on USB drives or network drives (external storage). Here's what each part does:
defaults write
: This allows you to modify macOS system preferences and application-specific property lists.com.apple.desktopservices
: This is the domain (or preference file) related to Finder.DSDontWriteUSBStores
: This is the specific key in thecom.apple.desktopservices
domain that disables the writing of.DS_Store
files to external drives when set.-bool true
: This sets the key (DSDontWriteUSBStores
) to booleantrue
or "enabled".
What are .DS_Store
files?
.DS_Store
files are hidden files that macOS Finder uses to store metadata and preferences (like view settings and icon positions) for each folder.
Effect of the Command
By running this command, macOS Finder is configured to stop creating .DS_Store
files on USB drives (or network drives, in some cases). This is useful to avoid cluttering external drives with unnecessary hidden files, especially when sharing them with non-macOS systems.
To apply the change
After running the command, you may need to restart Finder for changes to take effect. You can do so with the command:
killall Finder
To undo the change
If you want to allow Finder to write .DS_Store
files again, you can revert the setting by running:
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool false
And restart Finder again if necessary.