I can create tar files compressed using lzma as such:

$ ls ./DbDumps
$ XZ_OPT=-9 tar cJf dbDumps.tar.xz DbDumps

But, what I really want to do ( but cannot ) is compress each individual file, and then create the tar file. for example:

$ cd DbDumps
$ xz.exe *dmp
$ cd ..
$ tar cf dbDumps.tar DbDumps

Should I investigate HomeBrew ? XZ.pkg ?

Actually, back in October www.aeyoun.com claimed that Yosemite, other than via tar, does not support *.xz file compression. Is this correct? Might it be that "*xz" is doable, but Apple just won't say "it is officially supported"??

  • Are you saying that you cannot do it because xz is not installed? I would imagine that xz must surely be installed, because you are able to get tar to use it. – Celada Jul 4 '15 at 3:29
  • @Celada No. the "xz" executable is not in my $PATH. I could look around the file system for the executable. But,, can you recommend a place for me to get the executable and install it? Is "homebrew"or"XZ.pkg" where I should start? – david Jul 4 '15 at 3:42
  • Homebrew definitely works. That (or maybe Macports) is how I have xz installed on my ancient MacOS 10.5 system, where Apple doesn't provide it. But you shouldn't need to use Homebrew. xz may not be in your $PATH, but it's got to be in there somewhere since tar is successfully using it. The heavy-handed way of finding it would be find / -name xz -print. – Celada Jul 4 '15 at 4:04

Of course you can. Firstly tar in most cases does not include compression, it hands that off to a helper (if it supports it at all). At first that helper was compress (.tar.Z). I have also seen gzip (.tar.gz or .tgz), bzip2 (.tar.bz2), infozip's zip and unzip tools (.tar.zip), and some I cant rember the official names for (.tar.lha, .tar.lhz, .tar.zoo, tar.bz, tar.z). All of these use compression separate from tar. so the easy way to do it would be just to find the path to the xz binary (it would be called xz not xz.exe). If it is not already installed on the system, the easiest way would be to install it from a third party repository like macports. And if all else fails you can always install from source (although I cannot imagine that it would come to this).

  • awesome. I can take thinks from here. thanks very much. – david Jul 4 '15 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.