Is there any way to prevent a Mac from creating dot underscore files?

35

18

At work we're letting one of our very tech savvy clients actually help out a little with a few development projects specific to him. However, he uses his own personal Macbook, and as he edits files on our (Windows) networks, his Macbook always creates a bunch of unnecessary meta files that we end up deleting later.

For instance, it creates a file called .DS_Store in any directory he opens, as well as "dot underscore" files for each file he edits. So for instance, if he's editing a file called "Main.php", his Macbook will create another file called "._Main.php".

I know there are ways to prevent creation of .DS_Store files, but none about how to prevent creation of these hidden files prefixed with dot underscore.

Is there any way to turn that off on Macs? Any way to prevent it from creating those files in the first place?

soapergem

Posted 2010-11-19T20:53:28.663

Reputation: 1 056

1Related topic, another one explaining what the ._ files are for. – Daniel Beck – 2011-04-01T17:49:25.990

possible duplicate of How to prevent Mac OS X creating .DS_Store files on non Mac (HFS) Volumes?

– Ƭᴇcʜιᴇ007 – 2013-09-19T14:29:43.197

Answers

18

Have your Mac user install BlueHarvest.

Blue Harvest

fideli

Posted 2010-11-19T20:53:28.663

Reputation: 13 618

It's worth noting that Ross Tulloch (the maker of BlueHarvest) offers a free version called BlueHarvest Lite. It is limited that you have to select and enable the feature for each new removable drive, but once set, it will keep that drive free of the junk. You can find it in the Mac App Store, however I'm not sure if it will work for network drives. You can give it a try.

– ADTC – 2014-07-01T08:30:15.837

6It should be noted this solution does not really prevent a Mac from creating ._ files as OP asked. It simply removes the ._ files when you eject the drive. To me, it means "adding insult to injury". – some user – 2015-05-19T23:30:06.343

Looks like the Lite version is no longer available. The download link just takes you to the paid App Store version. – davecave – 2017-08-14T14:07:37.077

6It's a commercial software. Anything else? – Artur Bodera – 2012-11-20T16:38:39.380

11

On Linux file servers or NAS devices you can use the following:

Option A. Samba configuration modification preventing both resource shares and .DS_Store files:

veto files = /._*/.DS_Store/

delete veto files = yes

(Configuration file located at /etc/samba/smb.conf or /etc/smb.conf depending on your distribution) Disadvantages: not all shares are provided by Linux-driven NAS systems, or on most you don't have shell access.

Option B. Create a simple shell script and run it from one of your connected machines using cron.

find /YourNetworkShareLocation -name '._*' -exec rm {} \;

Replace /YourNetworkShareLocation with where your network share is mounted, e.g. /Volumes/ShareName or /media/ShareName, etc.

Disadvantages: this is the brute's way - unnecessary load on both storage and network. However, the same can be easily done in Windows using a little PowerShell magic.

Disclaimer: This is not what I call "a solution", it's a hack. But it could help someone reduce the annoyance levels delivered by resource fork files.

Milen

Posted 2010-11-19T20:53:28.663

Reputation: 395

Is your samba config actually correct? It's a /-separated list? – OrangeDog – 2018-08-08T16:00:04.520

@OrangeDog Yes, it's a /-separated list: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html#VETOFILES

– devconsole – 2018-09-13T10:40:37.247

4

Have him look into the free and aptly-named Cleanup SMB Mess application. The developer says:

This applescript droplet will clean up Windows shares mounted through the Mac OS X samba client, by removing all "._*" files, .DS_Store files and .Trashes folders on all the volumes and folders dragged on it."

I've only used with thumb drives and MP3 players, and it does what it says it does. I'm guessing it has to scan the device to remove the garbage, and that may be cumbersome on a large network share. But that's only speculation on my part. I'd suggest asking the developer.

JRobert

Posted 2010-11-19T20:53:28.663

Reputation: 6 128

3

Use a program other than Finder such as MuCommander to browse your files. (works on Local drives too).

In OS X lion, this method should allow default access to ~/Library without modifying settings or hitting ALT as well.

I use MuCommander on Snow Leopard and Lion and noticed that neither HFS+ or ExtFat volumes end up littered with files with these files.

Folks: there is another issue, File size... many of the resource forks at are least 4096 bytes even when the original file is under 4096 bytes so eliminating this problem does help with File System Bloat.

(For example: Download the Text file: http://www.gamers.org/pub/games/idgames/levels/heretic/g-i/horror.txt on a Mac and see for yourself)

Marz

Posted 2010-11-19T20:53:28.663

Reputation: 31

2

You could also use a Mac app in the app store called 'Annoying File Be-Gone' that runs on the menubar and works well.

Phil

Posted 2010-11-19T20:53:28.663

Reputation: 21

0

On my QNAP NAS, the samba config in /etc/smb.conf already contained this:

veto files = /.AppleDB/.AppleDouble/.AppleDesktop/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/:2e*/.@__qini/.Qsync/.@upload_cache/.qsync/.qsync_sn/.@qsys/.digest/
    delete veto files = yes

so I edited the veto files line to:

veto files = /._*/.AppleDB/.AppleDouble/.AppleDesktop/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/:2e*/.@__qini/.Qsync/.@upload_cache/.qsync/.qsync_sn/.@qsys/.digest/

and then restarted samba (it's a primitive linux system so I did it via init.d):

/etc/init.d/smb.sh restart

Steve Goossens

Posted 2010-11-19T20:53:28.663

Reputation: 1

-1

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

You could also try using TinkerTool (http://www.bresink.com/osx/TinkerTool.html) - it used to expose this setting.

5arx

Posted 2010-11-19T20:53:28.663

Reputation: 1 438

Unfortunately, this doesn't cover creation of ._ metadata files. – Daniel Beck – 2011-01-31T12:46:16.317

-1

there is utility called "asepsis"

it is also has feature to clean your mac from .DS_Store files and so on read the FAQ

http://asepsis.binaryage.com/

deadElk

Posted 2010-11-19T20:53:28.663

Reputation: 1

The FAQ makes no mention of ._ files. – DavidPostill – 2015-09-16T16:48:19.843

-3

This is really easy and you don't need to install anything.

  1. Open Spotlight (cmd+space)
  2. Type in 'Terminal.App'
  3. And press enter (This should open the Terminal application)
  4. Copy this to your clipbpoard (cmd+c):

    defaults write com.apple.desktopservices DSDontWriteNetworkStores true

  5. and paste it into the terminal (cmd+p)

  6. press enter
  7. close the terminal (cmd+Q)
  8. Next time you restart finder, your Mac will stop writing DS files on network storage.

Ref: http://support.apple.com/kb/HT1629

Luke Browell

Posted 2010-11-19T20:53:28.663

Reputation: 7

4This link was already posted by the OP himself, who knows how to disable .DS_Store files from being created. The method does not prevent ._ files from being created though, as these are resource forks (and others) that are always written by the OS, even if you enable the DSDontWriteNetworkStores option. – slhck – 2013-04-04T09:09:45.283