Tar excluding ._ files

Solution 1:

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

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

Solution 2:

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