libarchive, bsdtar, bsdcpio

Comments, questions, patches:

Source Code and Downloads

All work on libarchive, bsdtar, and bsdcpio has moved to Any material here is useful only for archeological purposes.


Discussion about libarchive, including problems, questions, and ideas:


Subscribe here:

About versions: An a in the version indicates a release with known problems unsuitable for production use. A b in the version indicates a release with experimental features that work, but may not yet be fully tested. For production applications, please use the most recent non-alpha/non-beta release. Feedback on any version is always appreciated.

VERY OLD Documentation

What Is It?

Libarchive is a programming library that can create and read several different streaming archive formats, including most popular tar variants, several cpio formats, and both BSD and GNU ar variants. It can also write shar archives and read ISO9660 CDROM images and ZIP archives. The bsdtar program is an implementation of tar(1) that is built on top of libarchive. It started as a test harness, but has grown into a feature-competitive replacement for GNU tar. The bsdcpio program is an implementation of cpio(1) that is built on top of libarchive.

The bsdtar archiving program is built on libarchive, so offers a variety of modern features. One unusual feature it offers is the ability to function as a format-conversion filter, reading entries from one archive and emitting an archive in a different format with the same contents. This feature was simple to implement because libarchive's robust automatic format detection makes it unnecessary to specify the format of the input archive. More details are available in the bsdtar documentation.


A few years ago, there was a debate on one of the mailing lists about the FreeBSD package tools. The debate concerned two interrelated questions:

After looking into it a bit, I concluded that tar/gzip and tar/bzip2 were fine formats and that the performance problems were purely implementation issues.

So, I started a project to rewrite the package tools, beginning with pkg_add. Key to this project is a library that understands tar/gzip and tar/bzip2 archives. Once I had built libarchive, I realized that I nearly had a complete BSD-licensed replacement for GNU tar, hence bsdtar. My rewrite of pkg_add to use libarchive has stalled due to lack of time; I hope to get back to it sometime soon. An early prototype of the core ideas showed a three-fold performance increase over the earlier pkg_add implementation without any changes to the package file format.

Comments, questions, patches: