Is there a way to create a tar file in OS X (Sierra, preferably) that does not include the ._ files? I've tried using the --exclude option, but clearly don't know the right pattern to use.

  • What exactly have you tried? Please add the command line used to the question
    – nohillside
    Apr 16, 2017 at 13:13
  • What filesystem are you one ._ files are not usually there on HFS+
    – mmmmmm
    Apr 16, 2017 at 13:13

3 Answers 3


To suppress the creation of AppleDouble ._ files, use: --disable-copyfile

Example: tar --disable-copyfile -cf file.tar file

  • Wow. How terribly sneaky. Only becomes apparent they're in there when you go to extract. Even a listing with -t doesn't show them. And the option is not documented! Where do you discovery such sorcery for yourself? Nov 27, 2020 at 3:50
  • bsdtar 2.8.3 - libarchive 2.8.3 on macOS 10.14.6 doesn't work anymore, sadly.
    – toriningen
    Feb 11, 2021 at 20:20

The accepted answer didn't work on MacOS Monterey (V 12.4). The tar is bsdtar and the man page revealed that there's a separate option to be specified --no-mac-metadata

$ tar -czv --no-mac-metadata -f <file_name> <filelist>

Sequence of the options seem to matter as following command didn't give desired result:

$ tar --no-mac-metadata -czvf <file_name> <filelist>
  • To say that I am extremely disappointed to learn that a system tool has this borderline malicious "extension" enabled by default would be a serious understatement.
    – cbmanica
    Feb 7, 2023 at 22:28

In recent macOS versions --disable-copyfile option suggested in other answer might do nothing, but tar seems to honor COPYFILE_DISABLE environment variable. Use it like this:

COPYFILE_DISABLE=1 tar -cf file.tar file
  • 1
    RE: "In recent macOS versions --disable-copyfile option suggested in other answer does nothing," -- I find that statement to be false in macOS Catalina. I just tested it and it works! (Doesn't work in macOS Big Sur) Feb 11, 2021 at 20:32
  • @user3439894 well, --disable-copyfile doesn't work in Mojave, and I can't test other versions. Weird.
    – toriningen
    Feb 12, 2021 at 0:03
  • COPYFILE_DISABLE=1 works for me with macOS Sierra Mar 30, 2021 at 13:50

You must log in to answer this question.

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