What invocation will use LZMA to compress tar output on my Mac (OSX 10.12.x)?

7,150

When using tar, the first word after -f is the output filename. In your case, switching the order of options might be enough:

tar -c --lzma -f foo.tar.lzma sourcefile(s)
Share:
7,150

Related videos on Youtube

Christos Hayward
Author by

Christos Hayward

Updated on September 18, 2022

Comments

  • Christos Hayward
    Christos Hayward over 1 year

    I've tried several invocations of the OEM tar to create LZMA-compressed tarballs. More specifically, I tried:

    tar -c -f --lzma Windows\ 7.vmwarevm.tar.lzma Windows\ 7.vmwarevm
    

    My efforts created an archive with filename --lzma, and tar complained of Windows 7.vmwarevm.tar.lzma: Cannot stat: No such file or directory, probably for the same reason: --lzma was taken as the filename of the archive to be created, and consequently the actual intended archive name was taken to be the first in a list of arguments to include in the archive.

    I thought after some searching that MacOS had not included it in the provided options, and built GNU tar from scratch, storing it under another name in /usr/local/bin. However, my efforts to use the above invocation with the renamed and newly built tar had the same effect: I was building an archive in --lzma.

    My computer has a seemingly working /usr/local/bin/lzma.

    What invocation(s) should I use, perhaps piping tar to lzma and perhaps in a script to do the work of "tar czf foo.tgz foo", but uses lzma instead of gzip for compression?

    • Christos Hayward
      Christos Hayward over 6 years
      Thank you; please restate your comment as an answer so I can accept it.