운영체제/MAC

[mac] 'tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'

louky 2024. 8. 29. 08:11
반응형

맥북에서 tar 압축하여 리눅스 장비에서 압축을 풀때 아래와 같은 에러 메시지가 나와 당황하였습니다. 

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

 

그동안 왜 인지를 못했던건지 모르겠지만 영향은 없지만 그래도 은근 신경이 쓰여서 찾아 보았습니다. 

 

찾아보니 tar의  version이  맥북과 리눅스의 차이가 있었습니다. 

 

맥북 (M1기준)

$ tar --version
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8

 

리눅스 (ubuntu)

$ tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

 

bsdtar 이냐 Gnu tar냐에 따른 차이로 발생하는 문제임을 알게 되었습니다. 

 

이에 찾아보니 친절하게 GNU tar를 설치를 할수가 있었습니다. 

 

$ brew install gnu-tar

# 설치 확인 및 version 확인
$ gtar --version
tar (GNU tar) 1.35
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

 

 맥북에서 Gnu Tar로 압축하고  리눅스에서 압축을 풀면 더이상 해당 에러 메시지를 나오지 않는 것을 확인 할 수 있었습니다. 

 

Tip! 필요 하신 분들만...

gtar라는 명령어를 매번 사용하면 괜찮겠지만 무의시적으로 tar를 사용할 때  또는 리눅스와 혼동이 있을 것 같아 필자의 경우 아래와 같이 설정하여 사용하고 있습니다. 

 

# gtar읠 실제 경로 확인 
user@userMacbook: ~ $ which gtar
/opt/homebrew/bin/gtar

# Alias 설정
# 사용자 환경에 따라 .zshrc 또는 .bashrc 등 사용자 profile 또는 rc 파일에 추가
user@userMacbook: ~ $ echo "alias tar='/opt/homebrew/bin/gtar'" >> ~/.alias

# Alias 파일  또는 사용자 환경파일 load   
user@userMacbook: ~ $ source ~/.alias

# GnuTar로 실행 되는지 확인 
user@userMacbook: ~ $ tar --version
tar (GNU tar) 1.35
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

############################
# bsd tar로 실행 하고자 할 경우 
############################
#  \(역슬래쉬)tar or /usr/bin/tar
user@userMacbook: ~ $ \tar --version
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8

user@userMacbook: ~ $ /usr/bin/tar --version
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8

 

반응형