Celeb Glow
news | March 20, 2026

Create Tar On Ubuntu And Mac With Same MD5

I have a folder of files which I am trying to tar into an archive. I have the same files on a Mac and on a Ubuntu machine. If I run an rsync it shows that the directories are the same, but if I tar them and then take a MD5 sum the results are different. I have tried with both GNU tar and BSD tar on the Mac. Is there some option that has to be used to make the result come out the same?

Thanks.

EDIT:

The same thing happens on Ubuntu to RHEL 7 as well. Here are the steps I am taking:

  • Create tar archive of directory on Ubuntu, using --exclude='.*' to exclude hidden files
  • take sha256sum of tar file
  • use gpg to encrypt archive
  • take sha256sum of encrypted tar file
  • transfer file to Mac/RHEL 7 machine
  • check sha256sum of encrypted file on Mac/RHEL 7
  • decrypt and check sha256sum of tar file
  • untar archive
  • tar files again on Mac/RHEL 7
  • take sha256sum of new archive

This sum will be different from the original tar file, even though the files in the archive are the same. I've used tar -t and rsync to check this. I've tried using --owner=0 --group=0 --mtime='1970-01-01' --mode=664 on both ends as well but this doesn't help.

I'm assuming that something like the tar version or something is added a file header and that this is different on each machine because of the different OS versions. Any ideas on how to get around this?

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy