tar: Ignoring unknown extended header keyword

Explains the ‘Ignoring unknown extended header keyword’ message when using tar between macOS and Linux, why it happens, and how to address it.

Jun 11, 2024 · 1 min read · 100 Words · -Views -Comments · Programming
Linux 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

After creating a tar archive on macOS and extracting on CentOS/Linux, you may see: tar: Ignoring unknown extended header keyword LIBARCHIVE.xattr.com.apple.metadata:kMDItemTextContentLanguage. This is due to differences in macOS tar. Notes below.

Problem

On macOS, create the archive:

tar -czvf  ../xxxx.tar.gz --exclude='.DS_Store' xxxx/*

On CentOS, extract:

tar -C xx/lib -xz

You’ll see output like:

tar: Ignoring unknown extended header keyword LIBARCHIVE.xattr.com.apple.metadata:kMDItemTextContentLanguage

Why

  1. macOS uses BSD tar and writes xattr headers. CentOS commonly uses GNU tar.
  2. The message is informational; extraction still works.

Fix

Install GNU tar on macOS: brew install gnu-tar, then create with gtar -czvf ../xxxx.tar.gz --exclude='.DS_Store' xxxx/*.

References

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover