tar: Ignoring unknown extended header keyword

tar: Ignoring unknown extended header keyword

6月 11, 2024 · 1 分钟阅读时长 · 100 字 · -阅读 -评论

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

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源