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 (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.)

Solution 1:

XZ support on macOS isn't broken, it's just restricted to tar. :-)

There is nothing to worry about using Homebrew though. Head over to brew.sh to get started and then run brew install xz to install the xz binary.