Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When plugging a USB stick into a Mac, OS X creates a number of hidden files on the stick, including a Spotlight index and Trash folder.

Example from the terminal for a USB stick "Untitled":

$ ls -a /Volumes/Untitled

It even does this on the xD memory card for my camera, so after having copied my pictures and deleted them from the card, the card is still full.

Is it possible to turn this off for USB and memory cards, so OS X either writes these files to the primary disk or doesn't write them at all?

share|improve this question
Sidenote: A journaled filesystem automatically generates these files. While indexing isn't integral to journaling, fseventd, for example, is. Though an HFS+ scheme has its benefits (IE, lack of fragmentation), you've pointed out one of its drawbacks. If you format the drive as exFAT or FAT32, it would both be compatible and solve your issue. The current solutions provided are all, essentially, different methods to unjournal a journaled format. – njboot May 10 '14 at 10:30
Unfortunately, this has nothing to do with journaling, rather it is a "feature" of the Mac. There are several processes that write these files, including Spotlight and Finder. This behavior happens on any filesystem, not just HFS+. (Yes, it also writes the invisibles to FAT and FAT32 volumes.) – quickthyme Jul 28 '14 at 22:45
The reason the card is still full when you've deleted it from the card is because "deleting" just puts it in the local .Trashes folder. There is a Trash folder on each drive, so all you have to do is empty the Trash after deleting and that space will be free again. – krs013 Jun 18 '15 at 21:28

13 Answers 13

up vote 16 down vote accepted

As I know you have 2 choices :

  1. TinkerTool (free)

alt text

  1. BlueHarvest (commercial)

alt text

share|improve this answer
OK, thanks. Was kind of hoping that there would be a built-in setting somewhere, but at least there's a solution available. – j-g-faustus Jan 20 '11 at 18:08
@Philip: Unfortunately Tinkertool only deals with .DS_Store files according to their detail page, which presumably means that this is the only hidden file that can be disabled through the CLI - the other files need custom tools. But BlueHarvest looks nice, and does what I need. (Found some more details on the issue here and here) – j-g-faustus Jan 20 '11 at 18:47
outdate! later answers are better – qarma Aug 19 '13 at 9:46
@j-g-faustus Not only Tinkertool only deals with .DS_store files but it does so just for network fileysystems – nhed Apr 14 '14 at 16:23
Tested it. Tinkertool doesn't work on USB drives (on 10.9 at least) – pufferfish Jun 15 '14 at 19:21

For just a particular mounted volume - like a flash drive called yourUSBstick in this example - these commands will remove existing cruft, stop Spotlight indexing now and in the future, stop the related fsevents logging, and disable the Trash feature.

mdutil -i off /Volumes/yourUSBstick
cd /Volumes/yourUSBstick
rm -rf .{,_.}{fseventsd,Spotlight-V*,Trashes}
mkdir .fseventsd
touch .fseventsd/no_log .metadata_never_index .Trashes
cd -

Other unfamiliar stuff you may still see you probably want to keep, like Apple double "._*" files and other Apple DS cruft relating to icons and window placement.

share|improve this answer
While this may disable indexing, those files and directories will still be present on the volume (which is the annoying part in the first place), and if you delete them .Spotlight* and .fseventd will come back. In fact, .metadata_never_index is one more entry in the file listing than the usual cruft. – ShreevatsaR May 21 '11 at 8:02
+1, Actually, I came up with he idea of touching trashes myself and went here for a better solution, but having seen this one couldn't resist +1 it. It solves the real problem — stopping car audio from playing trashed files ;) – Michael Krelin - hacker Feb 1 '12 at 19:33
+1 knew this existed but always have to find it when I need it. This is useful if you have more access to the USB drive than to the OSX system. – Matthew May 30 '14 at 13:00
Thanks, I didn't know about "cd -". I've still been pushing pushd/popd :). – studgeek Dec 6 '14 at 16:16
What about directory ".DS_Store" ? That's still there. Any reason why that was not included in the "rm -rf" line? – Marnix A. van Ammers May 25 at 4:22

To keep Spotlight from indexing non system volumes, add /Volumes to the Privacy list in System Preferences > Spotlight.

/Volumes is the point in the file system where all non-system disks are mounted by default.

enter image description here

share|improve this answer
impossible to add /Volumes in 10.8; it's possible to add individual volumes one at a time though. I suspect it's similar to mdutil -i off /Volumes/xxx – qarma Aug 19 '13 at 9:47
@qarma It is very possible to add /Volumes in 10.8 or later. Simply open a Finder window, press Shift+Command+G to bring up the "Go to folder..." window, type /Volumes, and then drag the little folder icon at the top of the Finder window (next to the word "Volumes") into the list in the screenshot above – Chris Mukherjee Nov 20 '14 at 20:01
I'll have to try that out... – qarma Nov 21 '14 at 9:02

Another way to deal with (just the) spotlight files, is to add that volume to your Spotlight exclude list. Plug the device in, and go to the Spotlight prefpane in System Preferences. Select the Privacy tab. Now drag that volume from your desktop up into the privacy list.. or use the + button at the bottom to add it. No more spotlight indexing will happen on that volume.

share|improve this answer
Thanks, I'll try that. – j-g-faustus Jan 21 '11 at 8:16
  1. Insert the USB drive.
  2. Navigate to Macintosh HD > Applications > Utilities and open Terminal.
  3. At the Terminal prompt, type the following command, replacing path_to_volume with the real path:

    sudo mdutil -i off /path_to_volume

  4. Press return.

  5. If prompted for a password, type your admin password, then press return. You will receive the response:

    /path_to_volume/: Indexing disabled for volume. in Mac OS X 10.4 or

    /path_to_volume: Indexing disabled. under Mac OS X 10.5 or later.

    Spotlight will immediately cease to index the specified volume.

  6. If you are using Mac OS X 10.5 or later, skip to step 9.

  7. At the Terminal prompt, type the following command, again substituting the correct path:

    sudo mdutil -E /path_to_volume and press return

  8. If prompted for a password, type your admin password, then press return. You will receive the response:

    /path_to_volume/: Volume index removed.

  9. At the Terminal prompt, type exit then press return.
  10. Quit Terminal.

Thanks to, their troubleshooting Mac OS X e-books, and their website for the detailed explanation of why other methods sort of work.

share|improve this answer
Note sudo asks for the current user's password – Mark Feb 16 '13 at 8:21

I use the MacOS Terminal command line to list and delete all these files and folders before ejecting the device from the desktop. For some files, you may have to sudo the /bin/rm command.

share|improve this answer
That's what I do too. Although it would be even better if I didn't need to, so I'm investigating the alternatives. – j-g-faustus Jan 20 '11 at 20:26
By the way, the device is found somewhere at /Volumes/<name> – DerMike Jan 21 '11 at 11:31

I use Clean Eject (free) and a custom Automator Service (still private) so I can assign a hotkey to clean & eject a volume using the app.

share|improve this answer
Without access to the Automator Service you mentioned this answer isn't actually very helpful. Can you share the service as well? – patrix Jan 9 '14 at 10:54
The answer is absolutely helpful - you can use the app without the Automator action. If you want to add a special shortcut key for Clean Eject then you have lots of options: Alfred, Keyboard Maestro. The Automator action is not essential, but is useful. I will upload it when I can to: – matt Jan 10 '14 at 12:35
The service I use to Clean Eject selected finder volumes is now uploaded to by site (see above for link). – matt Jan 10 '14 at 12:56
Thanks for the upload, makes the answer much more complete. – patrix Jan 10 '14 at 13:25

This should really be a comment, but I don't have enough points to actually comment so I had to write a separate answer.

If a moderator could move this to the right location, I would really appreciate it. :)

Anyway here's what I wanted to say:

~ ~ ~ ~ ~ ~ ~

@ Miles Leacy's post

and @ qarma's comment:

No, this is still possible even in OSX 10.9, but you need to do a few extra steps now:

1) In Finder click Go then click Go To Folder...

2) Type /Volumes and click Go.

3) A Finder window will open, and it should say Volumes at the top.

This is the most important step:

4) Next to where it says Volumes at the top of the Finder window, there is a tiny blue folder icon. Click and drag this icon left into your Favorites panel.

5) Now you will have access to your Volumes folder anywhere, including in Spotlight settings like Miles Leacy suggested. (Whenever you need it, just click on the Favorites link to select it.)

Hope this helps,


Vlad :)

~ ~ ~

How to add the Volumes folder to your Favorites so that you can access it in the Spotlight settings

~ ~ ~

What it looks like after adding the Volumes folder to the Spotlight exceptions list:

Notice in the background you can see my post in Safari. ;)

What it looks like after adding the Volumes folder to the Spotlight exceptions list

share|improve this answer

An easy way to stop my car audio trying to read hidden Mac OS files is to remove them in Windows OS. Simply copy your MP3 music to the USB stick from iTunes. Swap the stick into Windows OS and select view hidden files from folder options. This will then allow you to delete every single hidden file that your trusty Mac placed on your USB stick including those pesky .trashes files. Finally a use for Windows OS!

share|improve this answer
+1 It is a bit tedious, but sure, why not, it does get the job done haha. – Vladimir Dec 10 '14 at 6:08

Actually touching the .Trashes file will be the best way to solve your main problem since .Trashes is now a file instead of a folder. This means that Apple can't relocate the files to the .Trashes folder when you delete them and your drive is no longer full.

Another option is to hit Cmd-Opt-Shift-Backspace to force Finder to empty the .Trashes content on the card before you eject it.

The first method is really the best as the second affects all Trash contents on all drives.

However, it seems from your post that you are more worried about the pollution of the drive by the various dot files. If you follow the steps mentioned above, you'll save your disk space, but there will be a minimum of dot files created.

share|improve this answer

I ended up using a free app "Hidden Cleaner". My car's MP3 player was trying to read .(MP3filename).mp3 (hollow, empty mp3 files) as well. Go to Macintosh HD in Devices section on the Finder left hand menu and drag your USB drive and drop onto the Hidden Cleaner app. It will cleanup the hollow files and leave the real MP3s and will eject your USB.

Note: That is not a permanent solution. You need to do above everytime you copy files. I don't mind though.

share|improve this answer
Another similar program: Eject for Windows… – Vinicius Pinto Oct 6 '14 at 1:57

Old question, but I, finally, discovered Asepsis. This is an open source utility that solves this age-old problem by confining all the .DS_STORE directories in one place, by default /usr/local/.dscage
After installation, and a reboot, no more .DS_STORE on USB drives, with the advantage (for some of us) of not having to disable indexing on external drives. Since version 1.4 it also supports OS X Mavericks.

Update from Aepsis website: "Warning: Asepsis is no longer under active development and supported under OS X 10.11 (El Capitan) and later.

share|improve this answer
Cool! I wonder how this program will handle a system crash or extreme CPU load. In other words, I wonder if a disycronization will bet automatically handled, or will need to do that your selves? Automaticlly is good because we don't need to worry about it, but it also means that the program will have to do a lot more checking. – Vladimir Nov 22 '14 at 7:41

it can't work.

no way to resolve this problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.