← Retour au blog
tech 4 May 2026

Tar Files Created on macOS Display Errors When Extracting on Linux (2024)

Creating tar files on macOS and extracting them on Linux can lead to errors. Learn why this happens and how to fix it.

Article inspired by the original source
Tar Files Created on macOS Display Errors When Extracting on Linux (2024) ↗ aruljohn.com

Introduction

If you use a Mac for development but deploy on Linux servers, you might have encountered issues when extracting tar.gz files created on macOS. This article explains why these errors occur and how to avoid them with practical and effective solutions.

Creating Tar Files on macOS

On macOS, creating a tar.gz file is straightforward. For instance, to compress a directory named pix, you would use the following command:

``bash tar -cvzf pix.tar.gz pix ``

Then, transfer this file to a Linux server via SCP:

``bash scp pix.tar.gz [email protected]:/tmp/ ``

Issues When Extracting on Linux

When you attempt to extract this file on a Linux server, error messages might appear:

``bash cd /tmp tar -xzvf pix.tar.gz ``

Common Errors

You often see errors like:

  • tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.quarantine'

These errors are due to macOS-specific metadata that are included by default in tar files.

Why Do These Errors Occur?

macOS uses the HFS+ or APFS file systems, which store additional metadata in files. When creating a tar file, these metadata are included, but they are not recognized by Linux systems.

Solutions to Prevent Errors

Solution 1: Use the --no-xattrs Option

A simple solution is to use the --no-xattrs option when creating the tar file to exclude these metadata:

``bash tar --no-xattrs -cvzf pix.tar.gz pix ``

Solution 2: Use the --disable-copyfile Option

Another option is to add --disable-copyfile to prevent copying the ._ files:

``bash tar --disable-copyfile -cvzf pix.tar.gz pix ``

Solution 3: Use gnu-tar

Installing and using gnu-tar instead of bsdtar on macOS can also solve these issues as it handles metadata better:

``bash brew install gnu-tar gtar -cvzf pix.tar.gz pix ``

Conclusion

By knowing these solutions, you can avoid errors when extracting tar files created on macOS on Linux systems. These simple adjustments ensure a seamless deployment.

Let's discuss your project in 15 minutes.

macOS Linux tar files metadata gnu-tar
Deepthix newsletter · 100% AI · every Monday 8am

An AI agent reads tech for you.

Our AI agent scans ~200 sources per week and ships the best articles to your inbox Monday 8am. Free. One click to unsubscribe.

Visit the newsletter page →

Want to automate your operations?

Let's talk about your project in 15 minutes.

Book a call