How to install and get
xz in OS X… It’s not difficult since there is a pkg-file to just download and install.
When downloading or creating archives, you may see/use some different extensions like
tar.bz2 etc. Tar is more like the container and the final extension is the compression being used -
You might compress a folder into a
tar.gz (gzip) like:
tar -zcvf fooBar.tar.gz --exclude ".DS_Store" --exclude "._*" "fooBar";
And extract it like:
tar -zxvf fooBar.tar.gz
Same thing with
tar.bz2 (bzip2), like:
tar -jcvf fooBar.tar.bz2 --exclude ".DS_Store" --exclude "._*" "fooBar"; tar -jxvf fooBar.tar.bz2
--exclude ".DS_Store" --exclude "._*"will exclude .DS_Store and AppleDouble files.
You can also put in your
~/.bash_profile if you are using that one.
# No .DS_Store etc in "tar" export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
xz can create much smaller archives, which is great if you have many. So when using
bz2 it is actually a really waste of disk space.
There’s a great article over at “imoverclocked” called: For the love of bits, stop using gzip!
So, how to install it in OS X… It’s not included in OS X by default, so head over to XZ Utils - there’s a link to an OS X package file at SourgeForge: Mac OS X Packages. At the time of writing the version is 5.0.7.
Download and install the package. It will install in:
$ which xz /usr/local/bin/xz
For Linux/*BSD… If not already installed, you’ll find it in your package manager (eg pacman, dnf, apt etc).
Refer to the manual for all the options. It’s great and extensive, but here’s an example:
tar -cvf - "folder" | xz -4e > "folder".tar.xz; tar -xvf folder.tar.xz folder
-4eis the level of compression. Like:
-2efor less compression etc.
If you are using
git you can add to your
[tar "tar.xz"] command = xz -c
git archive --format=tar.xz -o ../RepoName.tar.xz --prefix=RepoName/ master;
That will put the archive in the parent folder, right next to your repository.