Sample Header Ad - 728x90

Ask Different (Apple)

Q&A for power users of Apple hardware and software

Latest Questions

1 votes
1 answers
180 views
MacOS & tar: why is --disable-copyfile and --no-xattrs required for GNU compatibility?
I'm noticing on macOS v13.7 BSD tar files have unexpected contents when unpacking on GNU Linux. For GNU compatibility I need to use `tar --disable-copyfile --no-xattrs`, otherwise I end up with this issues untiring on a GNU system: tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com....
I'm noticing on macOS v13.7 BSD tar files have unexpected contents when unpacking on GNU Linux. For GNU compatibility I need to use tar --disable-copyfile --no-xattrs, otherwise I end up with this issues untiring on a GNU system: tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.metadata:kMDItemTextContentLanguage' ... Duplicate files F prefixed ._F in the tar file. I see following workaround posted here and here , however no explanation why macOS tar needs to behave this way. Does anyone know why macOS tar is behaving this way?
atod (77 rep)
Feb 10, 2025, 08:40 PM • Last activity: Mar 12, 2025, 11:38 PM
18 votes
6 answers
59457 views
How uncompress tar.lz file
I was trying to uncompress a tar.lz file. https://unix.stackexchange.com/questions/218230/why-i-cant-unpack-tar-bz2-or-tar-xz-files/218232#218232 Joses-MacBook-Air:~ joseluisbz$ ls -al /usr/local/Sources/ddrescue-1.22.tar.lz -rw-r--r--@ 1 joseluisbz wheel 80050 Oct 4 14:43 /usr/local/Sources/ddrescu...
I was trying to uncompress a tar.lz file. https://unix.stackexchange.com/questions/218230/why-i-cant-unpack-tar-bz2-or-tar-xz-files/218232#218232 Joses-MacBook-Air:~ joseluisbz$ ls -al /usr/local/Sources/ddrescue-1.22.tar.lz -rw-r--r--@ 1 joseluisbz wheel 80050 Oct 4 14:43 /usr/local/Sources/ddrescue-1.22.tar.lz Joses-MacBook-Air:~ joseluisbz$ tar zxvf /usr/local/Sources/ddrescue-1.22.tar.lz -C /usr/local/Sources/ tar: Unrecognized archive format tar: Error exit delayed from previous errors. Joses-MacBook-Air:~ joseluisbz$ xz xz: Compressed data cannot be written to a terminal xz: Try `xz --help' for more information. Joses-MacBook-Air:~ joseluisbz$ xz -dv /usr/local/Sources/ddrescue-1.22.tar.lz /usr/local/Sources/ddrescue-1.22.tar.lz (1/1) xz: /usr/local/Sources/ddrescue-1.22.tar.lz: File format not recognized Joses-MacBook-Air:~ joseluisbz$ tar xjf /usr/local/Sources/ddrescue-1.22.tar.lz -C /usr/local/Sources/ tar: Unrecognized archive format tar: Error exit delayed from previous errors. Joses-MacBook-Air:~ joseluisbz$ tar -xjf /usr/local/Sources/ddrescue-1.22.tar.lz -C /usr/local/Sources/ tar: Unrecognized archive format tar: Error exit delayed from previous errors. Joses-MacBook-Air:~ joseluisbz$ tar -xjf /usr/local/Sources/ddrescue-1.22.tar.lz tar: Unrecognized archive format tar: Error exit delayed from previous errors. Joses-MacBook-Air:~ joseluisbz$ **What can I do?**
Chepe Questn (478 rep)
Oct 4, 2017, 08:32 PM • Last activity: Nov 29, 2024, 11:34 AM
1 votes
1 answers
85 views
Could a 163-bytes size difference between the tgz of two different 590mb dirs be caused just from file metadata? Or is the file data diff?
While trying to remove duplicates of MRI readings I am tarring / compressing (**tgz**) the top-level directory with a mix of executables, pdf, text, dll, and data in proprietary format (but sometimes with different "last modified" dates). Any tgz files with same byte-size, I consider duplicate MRI s...
While trying to remove duplicates of MRI readings I am tarring / compressing (**tgz**) the top-level directory with a mix of executables, pdf, text, dll, and data in proprietary format (but sometimes with different "last modified" dates). Any tgz files with same byte-size, I consider duplicate MRI scans. I am comparing 10+ MRI datasets that have been stored in a variety of compression formats in local and cloud drives for 10+ years. I'm sure some are duplicates. > tar cfa mri01.tgz MRI01 > tar cfa mri02.tgz MRI02 For datasets that are, before tgz compression, typically about 615-mb with about 135 files, I sometimes see no size difference, a size difference of only 150-bytes or so, and significant size differences in the tgz files. I don't know what to think. Could a 150-byte size difference between the tgz of such large datasets be caused just by file meta-data, like "last modified date"? Or, does such a tiny size difference indicate these are different MRI scans? Is there a better way to detect duplicates of this type of data?
smithknown34 (11 rep)
Aug 27, 2023, 08:24 PM • Last activity: Jan 25, 2024, 02:56 AM
1 votes
2 answers
2528 views
How can I extract multipart tar files from the command-line on macOS?
I have multiple 2 GiB gzipped-tar files (`.tgz`) I downloaded from an online service with Safari. It's a Google Takeout of my entire photos library. As each file downloaded, Safari automatically decompressed them so in the end I had 21 `tar` files in my Downloads folder. How can I extract the conten...
I have multiple 2 GiB gzipped-tar files (.tgz) I downloaded from an online service with Safari. It's a Google Takeout of my entire photos library. As each file downloaded, Safari automatically decompressed them so in the end I had 21 tar files in my Downloads folder. How can I extract the contents of these multiple tar files?
deed02392 (232 rep)
Apr 10, 2023, 11:20 PM • Last activity: Oct 14, 2023, 11:05 AM
1 votes
0 answers
42 views
tar can't extract the archive - tar: "Failed to set default locale"
I have set `LANG` to **en_GB.utf8**. I received a `tar` archive, which I can list fine with `tar tf FILENAME`, but when I want to extract it with `tar xf FILENAME`, no file is extracted, and I get the error message tar: Failed to set default locale Therefore I tried a LANG=C tar tf FILENAME and this...
I have set LANG to **en_GB.utf8**. I received a tar archive, which I can list fine with tar tf FILENAME, but when I want to extract it with tar xf FILENAME, no file is extracted, and I get the error message tar: Failed to set default locale Therefore I tried a LANG=C tar tf FILENAME and this managed to extract the tarball. I guess _tar_ somehow knows that the archive was created under the C locale, and needs the C-locale to properly create the extracted filenames, but why can't it set this by itself? Running under zsh on Monterey.
user1934428 (1458 rep)
Jun 26, 2023, 11:33 AM • Last activity: Jun 28, 2023, 08:11 PM
2 votes
0 answers
111 views
Archive Utility does not extract all files from tar archive
Archive Utility vs BSD tar behaviour: ```zsh echo -n 'Hello' >hello.txt # "Hello" in hello.txt tar cvf hello.tar hello.txt # hello.tar contains "hello.txt" file with "hello" text echo ' world!' >>hello.txt # "Hello world!" in hello.txt tar rf hello.tar hello.txt # hello.tar contains 2 versions of "h...
Archive Utility vs BSD tar behaviour:
echo -n 'Hello' >hello.txt  # "Hello" in hello.txt
tar cvf hello.tar hello.txt # hello.tar contains "hello.txt" file with "hello" text
echo ' world!' >>hello.txt  # "Hello world!" in hello.txt
tar rf hello.tar hello.txt  # hello.tar contains 2 versions of "hello.txt" file a first with "Hello" text and second with "Hello world!\n" text
tar tvf hello.tar           # to confirm!
rm hello.txt                # hello.txt removal
tar xvf hello.tar           # tar extracts the two hello.txt files, i.e. the first then the second overwriting the first
cat hello.txt				# "Hello world!" expected
One-liner:
echo -n 'hello' >hello.txt; tar cvf hello.tar hello.txt; echo ' world!' >>hello.txt; tar rf hello.tar hello.txt; tar tvf hello.tar; rm hello.txt ; tar xvf hello.tar; cat hello.txt
Same behaviour with both BSD tar and GNU tar As "tar" stands for Tape ARchiver ... it is historically meaningful to provide the option to physically append a corrected file to the archive on recorded on the tape without requiring to completely erase the tape first ... Question: Now try to extract hello.tar with MacOS "Archive Utility" and you have only hello.txt with "Hello" ... why!? So to my point of view, "Archive Utility" does not extract all files ... -/- Bonus question: And if "hello.txt" already exists in the folder, "Archive Utility" will extract the first file as "hello 2.txt" without even requesting which action the user wants (i.e. a rename or an overwrite) ... why!?
Frédéric (121 rep)
May 8, 2023, 01:00 PM
1 votes
1 answers
110 views
Error while making automator service to archive files with tar
I wrote an automator service to be create tar archives using the `tar` command, due to this format being more efficient than the `.zip` that the "Compress" option in the finder menu gives me. However on running the service it just gives me this error, regardless of the type of file used: [![tar: fil...
I wrote an automator service to be create tar archives using the tar command, due to this format being more efficient than the .zip that the "Compress" option in the finder menu gives me. However on running the service it just gives me this error, regardless of the type of file used: tar: file.txt: Cannot stat: Bad file descriptor This is the source of the service: Automator script (Using a slightly modified version of [https://stackoverflow.com/questions/35138806/automator-action-shell-script-to-tar-multiple-files-folders-containing-spaces](https://stackoverflow.com/questions/35138806/automator-action-shell-script-to-tar-multiple-files-folders-containing-spaces))
EvilSquirrelGuy (163 rep)
Jun 10, 2022, 06:51 PM • Last activity: Jan 20, 2023, 01:03 AM
0 votes
2 answers
2035 views
How to extract How uncompress .tar.lrz file?
I have `.tar.lrz` file in mac which I have to decompress. I have already checked https://apple.stackexchange.com/questions/301016/how-uncompress-tar-lz-file and the solution there does not work. I think the reason is that is for `tar.lz` and I am dealing with `.tar.lrz` I am trying decomprees file f...
I have .tar.lrz file in mac which I have to decompress. I have already checked https://apple.stackexchange.com/questions/301016/how-uncompress-tar-lz-file and the solution there does not work. I think the reason is that is for tar.lz and I am dealing with .tar.lrz I am trying decomprees file from https://github.com/lin-tan/CoCoNut-Artifact/releases/tag/training_data_1.0.0
Exploring (281 rep)
Aug 22, 2022, 05:19 AM • Last activity: Aug 22, 2022, 10:57 AM
15 votes
3 answers
12105 views
Tar excluding ._ files
Is there a way to create a tar file in OS X (Sierra, preferably) that does not include the ._ files? I've tried using the --exclude option, but clearly don't know the right pattern to use.
Is there a way to create a tar file in OS X (Sierra, preferably) that does not include the ._ files? I've tried using the --exclude option, but clearly don't know the right pattern to use.
Scott Hunter (265 rep)
Apr 16, 2017, 01:07 PM • Last activity: Jul 20, 2022, 02:43 PM
1 votes
1 answers
11737 views
tar: could not chdir to 'dirname' when using -C with tar
I downloaded [this file](https://github.com/psf/requests/tarball/main) and when I try to use `-C` with `tar` to change the name of the directory it outputs to, I get this error ```none $ tar -xvf requests.tar -C requests tar: could not chdir to 'requests' ``` I don't get this error when extracting f...
I downloaded [this file](https://github.com/psf/requests/tarball/main) and when I try to use -C with tar to change the name of the directory it outputs to, I get this error
$ tar -xvf requests.tar -C requests
tar: could not chdir to 'requests'
I don't get this error when extracting files without -C. I tried this in /tmp and ~/Desktop I also tried passing an absolute path.
user98513
Mar 26, 2022, 07:55 PM • Last activity: Mar 26, 2022, 08:08 PM
0 votes
2 answers
1389 views
Cron job can't access Documents - "Tar: Desktop: Couldn't visit directory: Unknown error: -1"
I have an automated backup script that runs from a cron job. It basically tars up my home directory and pipes it to a command that writes the tarball to Amazon S3. tar zcvf - -X BACKUP_EXCLUDE | /usr/local/bin/aws s3 cp - ... It works fine if I run from the command line, but from a cron job it fails...
I have an automated backup script that runs from a cron job. It basically tars up my home directory and pipes it to a command that writes the tarball to Amazon S3. tar zcvf - -X BACKUP_EXCLUDE | /usr/local/bin/aws s3 cp - ... It works fine if I run from the command line, but from a cron job it fails with: tar: /Users/falk/Desktop: Couldn't visit directory: Unknown error: -1 tar: Error exit delayed from previous errors. I'm guessing this is some sort of security thing, likely "Full Disk Access". (Adding Desktop to my "BACKUP_EXCLUDE" file didn't seem to help.) Is there a way to whitelist tar to access all my files from cron? Or give cron jobs the same access as the same command executed from the terminal?
Edward Falk (1083 rep)
Nov 27, 2021, 08:10 AM • Last activity: Nov 27, 2021, 07:53 PM
3 votes
3 answers
1363 views
What exactly is chflags opaque, nodump?
I've gotten to grips with the chflags man page so far, even if it's rather uncommon for man pages. Nevertheless, I find 2 parameters very peculiar. What exactly does chflags opaque and nodump do? Manpage > https://ss64.com/osx/chflags.html
I've gotten to grips with the chflags man page so far, even if it's rather uncommon for man pages. Nevertheless, I find 2 parameters very peculiar. What exactly does chflags opaque and nodump do? Manpage > https://ss64.com/osx/chflags.html
BabyBoy (1069 rep)
Mar 20, 2021, 08:47 AM • Last activity: Mar 23, 2021, 01:02 AM
-1 votes
1 answers
669 views
Updating rsync through Homebrew vs updating through .tar download
What are some of the advantages and disadvantages of updating the version of rsync installed using Homebrew vs downloading a .tar file and installing it this way https://hargitai.co.nz/upgrade-rsync-on-mac-os-x/ Is what's offered through/from(?) Samba, Github ( https://github.com/rsyncOSX ), and Hom...
What are some of the advantages and disadvantages of updating the version of rsync installed using Homebrew vs downloading a .tar file and installing it this way https://hargitai.co.nz/upgrade-rsync-on-mac-os-x/ Is what's offered through/from(?) Samba, Github ( https://github.com/rsyncOSX ), and Homebrew (I saw one page describing it as a package manager) all the same program? Or is there some difference (maybe some are forks of others, for example)? What is Samba from the perspective of a personal computer running OSX?
whitelightning (99 rep)
Feb 23, 2021, 12:17 PM • Last activity: Feb 23, 2021, 12:42 PM
3 votes
1 answers
567 views
If I used tar to archive Time Machine's Backups.backupdb folder, can the resulting file be uploaded to a cloud service and later used without issues?
If I were to use `tar -xvf` to create an archived `.tar` file of the Backups.backupdb folder Time Machine creates, would it sufficiently preserve hard links, etc? For example, if I uploaded to, say Google Drive, and later downloaded it in the future and extracted it to a new drive, would the extract...
If I were to use tar -xvf to create an archived .tar file of the Backups.backupdb folder Time Machine creates, would it sufficiently preserve hard links, etc? For example, if I uploaded to, say Google Drive, and later downloaded it in the future and extracted it to a new drive, would the extracted folder still be readable my Time Machine? Or would the safer route be imaging the entire drive?
user321627 (379 rep)
Sep 6, 2020, 09:59 PM • Last activity: Sep 7, 2020, 07:57 AM
1 votes
1 answers
613 views
Compress file as .tar.gz instead of .zip
If I right click a file and I compress it I obtain a file.zip. Is it possible to set right click-->compress to produce a file.tar.gz as output? I always have to do it through terminal but many times I'd rather do it with a right click especially when I'm already in the finder looking at the folder
If I right click a file and I compress it I obtain a file.zip. Is it possible to set right click-->compress to produce a file.tar.gz as output? I always have to do it through terminal but many times I'd rather do it with a right click especially when I'm already in the finder looking at the folder
Erontado (123 rep)
Jun 7, 2020, 02:53 PM • Last activity: Jun 8, 2020, 06:50 AM
1 votes
0 answers
66 views
How can encrypted Apple DMGs be so fast to open?
On remote drive I have an encrypted .dmg and the same files in a gpg encrypted tar file. The DMG opens within seconds, but to access the tar file, I first need to decrypt it, in this 10 minutes, and then expand it, another 10 minutes. How can the Apple DMG be so fast? or where I read more about how...
On remote drive I have an encrypted .dmg and the same files in a gpg encrypted tar file. The DMG opens within seconds, but to access the tar file, I first need to decrypt it, in this 10 minutes, and then expand it, another 10 minutes. How can the Apple DMG be so fast? or where I read more about how it works?
OrigamiEye (448 rep)
Apr 1, 2020, 12:42 PM
3 votes
1 answers
5898 views
Does OSX 10.10.4 support LZMA compression at the individual file level (not tar files)?
From the command line, I would like to compress some database dumps using the LZMA algorithm. And, [OSX adds XZ support][1] (written in October of last year), claims " _It turns out the XZ support in OS X 10.10 is kind of broken. Single‐file XZ file streams like those created by XZ Utils, 7zip, and...
From the command line, I would like to compress some database dumps using the LZMA algorithm. And, OSX adds XZ support (written in October of last year), claims " _It turns out the XZ support in OS X 10.10 is kind of broken. Single‐file XZ file streams like those created by XZ Utils, 7zip, and other popular compression utilities are __entirely unsupported__ . Only XZ files containing a TAR archive are supported. OS X insist that there must be a TAR archive inside XZ files or it will choke on it._ " Is this true? I can create a tar archive with LZMA compression as such: > __$__ tar cfJ dbDumps.tar.xz DbDumps But, indeed OSX does not ship with an LZMA executable (as far as I understand). I learned in the Linux & Unix forum that I could use "Homebrew" or "MacPorts" to get an LZMA executable, but I've not done this yet because I want my Mac as stable as possible. - So, is there a way for me, from a command shell, to compress non-tar files using the LZMA algorithm without having to add custom apps from HomeBrew, MacPorts, etc.? (I cannot use a gui to perform the compression.)
david.t (461 rep)
Jul 9, 2015, 07:04 PM • Last activity: Nov 29, 2019, 08:46 AM
4 votes
1 answers
191 views
Unpacking a tarball via terminal like the Finder
If I have a .tar or .tgz or .tbz on my desktop, and I double click on it, I get the folder that was compressed, neatly decompressed right next to the archive file. Just like you'd expect. When I try to decompress a tarred item via the `tar` command, the output I get has the whole full path of the or...
If I have a .tar or .tgz or .tbz on my desktop, and I double click on it, I get the folder that was compressed, neatly decompressed right next to the archive file. Just like you'd expect. When I try to decompress a tarred item via the tar command, the output I get has the whole full path of the original compressed file. So for example, if I make a .tbz out of a folder on my desktop called "foo", and then I decompress it via tar -xf foo.tbz ~/Desktop/foo, what I get is: /Users/[user]/Desktop/foo/Users/[user]/desktop/foo/bar.txt Is there some magic flag in tar that I'm not seeing? I've googled up 'how-to' after 'how-to' that give you a simple tar command to extract a file, but all the directions I see give me my undesired result with long, unnecessary, super-nested result directors.
l008com (1835 rep)
Mar 20, 2019, 03:08 PM • Last activity: Nov 5, 2019, 07:25 AM
3 votes
1 answers
375 views
Is there a way to suppress valid files beginning with dot (.) in a tar archive giving false errors and files?
I have a tar compressed archive created on a linux system that has valid files in a directory beginning with dot (.). When I extract that tar file on a Mac, tar thinks that the dotted file is a resource fork On linux: ```bash # mkdir test_dir # cd test_dir # echo hello > ._SUCCESS.crc # cd .. # tar...
I have a tar compressed archive created on a linux system that has valid files in a directory beginning with dot (.). When I extract that tar file on a Mac, tar thinks that the dotted file is a resource fork On linux:
# mkdir test_dir
# cd test_dir
# echo hello > ._SUCCESS.crc
# cd ..
# tar cvzf test_dir.tar.gz test_dir
test_dir/
test_dir/._SUCCESS.crc
# tar tf test_dir.tar.gz 
test_dir/
test_dir/._SUCCESS.crc
On the Mac:
$ tar xzf test_dir.tar.gz 
tar: copyfile unpack (test_dir/SUCCESS.crc) failed: No such file or directory
$ ls -la test_dir
total 8
drwxr-xr-x  4 xxxx  xxxx  128 Jul 31 16:31 .
drwxr-xr-x  4 xxxx  xxxx  128 Jul 31 16:31 ..
-rw-r--r--  1 xxxx  xxxx    6 Jul 31 16:22 ._SUCCESS.crc
-rw-r--r--  1 xxxx  xxxx    0 Jul 31 16:31 SUCCESS.crc
Is there any way to suppress the belief that any given dot file is a resource fork? For the curious, this is part of a sequence file export from HDFS.
Traveler (226 rep)
Jul 31, 2019, 11:37 PM • Last activity: Jul 31, 2019, 11:48 PM
2 votes
1 answers
268 views
Is it safe to create a tarball of a Time Machine backup?
Is it possible for me to create a `.tar.gz`, `.tar.xz`, etc file of a `.backupdb`? Are there any precautions I need to take to ensure that all permissions, hardlinks, etc are preserved? Will `tar` destroy the de-duplication used in Time Machine's backups?
Is it possible for me to create a .tar.gz, .tar.xz, etc file of a .backupdb? Are there any precautions I need to take to ensure that all permissions, hardlinks, etc are preserved? Will tar destroy the de-duplication used in Time Machine's backups?
user321134 (203 rep)
Feb 14, 2019, 12:55 AM • Last activity: Feb 14, 2019, 01:06 AM
Showing page 1 of 20 total questions