I regularly copy firmware for a 3D printer to SD cards. I format the drive and copy the same set of files to each SD card, and the macOS metadata specific files always go with it (.fseventsd,.spotlight-V100, etc).

Is there a way in macOS or with 3rd party software that I can format the drive and copy the file system over without those files? I plan to do this for about 20 SD cards at a time so a single click or easily repeatable option is preferable.

I'm using Mojave if that makes a difference.

  • On what device are you formatting the SD card, and which format is being used? Are you using the SD cards right out of the package?
    – IconDaemon
    Jun 25, 2019 at 0:20
  • The SD cards are formatted with FAT and used on a 3D printer control board: duet3d.com/DuetWifi They come with the stock firmware on there, I replace it with a modified version of the structure.
    – Zach Rose
    Jun 25, 2019 at 18:17

3 Answers 3


These days most systems ought to be smart enough to simply ignore them if they don't know what they are.

macOS will put those 3 files [& more in some circumstances] on every disk it ever sees, whether you want it to or not. There is, as far as I'm aware, no way to prevent this - all you can do is try to delete them right before ejecting the disk.

There's a bash script on Superuser - How do I keep Mac OS X from saving hidden files on my flash drive? which would appear to do this, though idk how many times you are going to have to authorise the sudo command; hopefully once per session not once per disk.

Personally, I invested in the paid alternative, BlueHarvest, which does the same thing in a 'set & forget' manner & is customisable for different drive types & purposes..

Built-in support for deleting: .DS_Store, ._AppleDouble, .apdisk, .AppleDouble (folders via smb), .com.apple.timemachine.donotpresent, .fseventsd, .Spotlight-V100, .TemporaryItems, .VolumeIcon.icns, $Recycle.bin, Desktop.ini, Icon?, Thumbs.db


Well, you could consider writing a bash script and use mdutil with the -d, -i, -X options.

Usage: mdutil -pEsa -i (on|off) -d volume ...
       mdutil -t {volume-path | deviceid} fileid
    Utility to manage Spotlight indexes.
    -p             Publish metadata.
    -i (on|off)    Turn indexing on or off.
    -d             Disable Spotlight activity for volume (re-enable using -i on).
    -E             Erase and rebuild index.
    -s             Print indexing status.
    -t             Resolve files from file id with an optional volume path or device id.
    -a             Apply command to all volumes.
    -V vol         Apply command to all stores on the specified volume.
    -v             Display verbose information.
    -r plugins     Ask the server to reimport files for UTIs claimed by the listed plugin.
    -L path        List the directory contents of the Spotlight index on the specified volume.
    -P path        Dump the VolumeConfig.plist for the specified volume.
    -X path        Remove the Spotlight index directory on the specified volume.  Does NOT disable indexing.
NOTE: Run as owner for network homes, otherwise run as root.
  • This only addresses Spotlight metadata files not all the macOS metadata files within the scope of the question. Jun 25, 2019 at 8:42

I think the best method would be to create an image of the contents then use an imaging tool to copy that to each SD card. Etcher is the tool I use to write the image to the SD card, but it can also be done from the command line.

Here is a step-by-step tutorial on how to do the entire process from the command line. https://appcodelabs.com/how-to-backup-clone-a-raspberry-pi-sd-card-on-macos-the-easy-way

  • I tried this because it's what I use for my rasbperry pis but as soon as the imaging finished OSX put .fseventsd and .spotlight-v100 in the root directory of the SD card
    – Zach Rose
    Jun 26, 2019 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .