How to Disable the Creation of .DS_Store Files From a Mac

.DS_Store files can pollute the network and removable storage for non-Mac users. Learn what these files do and how to disable them.

If you’ve used a Mac for long enough, you know that when you create folders on macOS, the system automatically creates .DS_Store — or Desktop Services Store — files for each folder. These files are useful for keeping track of metadata and folder settings, like folder view options, sort options, and icon size and position.

And because this system file contains a dot in front of it (commonly known as a dot-file), you usually don’t see this file, as it’s automatically hidden in the Finder, even if you manually enable hidden file viewing in the Finder. However, if you share or view a folder that was created on a Mac on another operating system or via file sharing, you will.

SEE: Check out these tips on how to secure the work data on your Mac.

See also  Get this prime language studying app for greater than half off a lifetime subscription

This is where the problem can happen: When you create a folder on a network drive from within macOS and the Finder, these .DS_Store files will be created automatically. If you or your server admin become frustrated by the seemingly endless creation of these files, there is a quick and easy way to turn off the creation of .DS_Store files.

Stop .DS_Store on network stores

To stop having the Finder automatically create these files with network stores:

1. Open Terminal app — located in Applications > Utilities — and enter the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

2. Press return.

3. After the command is executed, reboot your Mac, and you’ll be good to go — no more .DS_Store files gunking up your network shares (Figure A).

Figure A

Disabling the ability for the Mac to create .DS_Store files on a network device is simple in the Terminal. Image: Cory Bohon/TechRepublic
Disabling the ability for the Mac to create .DS_Store files on a network device is simple in the Terminal. Image: Cory Bohon/TechRepublic

If you need to set certain folders a particular way and want to re-enable the creation of these files, the fix is just as simple.

See also  Which Is Best for Your Business?

To re-enable the .DS_Store file creation on network stores:

1. Open Terminal, and enter the command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores false

2. Reboot your system once the command is executed.

Note: The change is considered a per-user modification, so if you’re in a corporate environment with multiple Apple users, this command must be performed from each user’s account when logged on with their profile. This may be scripted out and run by your IT department as a logon script or as part of ongoing maintenance routine tasks through Apple Remote Desktop or other third-party management suites.

On network drives, you can easily remove the .DS_Store files that were created previously by just deleting them from the network drive.

Stop .DS_Store on removable drives

There is a hidden command in Terminal that can even stop .DS_Store files from being created on removable drives, such as USB drives, thumb drives and SD cards.

To stop .DS_Store files from being created on removable drives and media

See also  Matillion Announces Data Productivity Cloud Release

1. Open the Terminal — located in Applications > Utilities — and enter the following command (Figure B):

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

Figure B

Disabling the ability for the Mac to create .DS_Store files on a USB or removable media device is just as simple as disabling it for network devices. Image: Cory Bohon/TechRepublic
Disabling the ability for the Mac to create .DS_Store files on a USB or removable media device is just as simple as disabling it for network devices. Image: Cory Bohon/TechRepublic

2. Reboot your system once it’s executed.

If you find that you want the functionality back for removable media, you can go back to the default by typing the following command in Terminal and rebooting once done:

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool false

This customization makes it easy to ensure you don’t pollute network shares and removable media with these files when likely you won’t take advantage of the features Finder stores in these files. This will also go a long way to making Windows and Linux users stay sane when macOS users share files and folders with them.

Source: https://www.techrepublic.com/article/how-to-disable-the-creation-of-dsstore-files-for-mac-users-folders/