# Ar archives

**URL:** <https://www.ruby-forum.com/t/ar-archives/125724>\
**Category:** Ruby\
**Created:** [January 11, 2008, 3:04pm UTC](https://www.ruby-forum.com/t/ar-archives/125724 "2008-01-11T15:04:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![backz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@backz](https://www.ruby-forum.com/u/backz)\
**Post date:** [January 11, 2008, 3:04pm UTC](https://www.ruby-forum.com/t/ar-archives/125724/1 "2008-01-11T15:04:47Z")

</div>

Is there cross-platform way of extracting or creating `ar’ archives?

Daniel Brumbaugh K.

---

<div class="post-metadata">

**Author:** ![backz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@backz](https://www.ruby-forum.com/u/backz)\
**Post date:** [January 12, 2008, 9:40pm UTC](https://www.ruby-forum.com/t/ar-archives/125724/2 "2008-01-12T21:40:23Z")

</div>

On Jan 11, 2008, at 06:03 AM, Daniel Brumbaugh K. wrote:

> Is there cross-platform way of extracting or creating `ar’ archives?

ar(5) on my system says this:

> A file created with ar begins with the ``magic’’ string “!  
> \n”. The rest of the archive is made up of objects, each of which  
> is composed of a header for a file, a possible file name, and the  
> file contents. The header is portable between machine  
> architectures, and, if the file contents are printable, the archive  
> is itself printable.

and proceeds to describe the latest version of the format which fits  
in about 26 lines. It should be really easy.

It makes a note at the bottom of the magic strings for older versions  
of ar, but these are probably ancient.

---

<div class="post-metadata">

**Author:** ![backz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@backz](https://www.ruby-forum.com/u/backz)\
**Post date:** [January 13, 2008, 2:26pm UTC](https://www.ruby-forum.com/t/ar-archives/125724/3 "2008-01-13T14:26:57Z")

</div>

- Eric H. (removed\_email\_address@domain.invalid) wrote:

> On Jan 11, 2008, at 06:03 AM, Daniel Brumbaugh K. wrote:
> 
> > Is there cross-platform way of extracting or creating `ar’ archives?  
> > [answer, which from a Mac user might only apply to BSD ar?]

Speaking of archive handling, a nice project for someone might be a Ruby  
interface to BSD’s libarchive[1], which would provide instant support  
for tarballs of many different formats, cpio, pax, BSD/GNU ar, write  
support for shar and read support for ISO images and zip archives, as  
well as transparent gz/bz2/z handling. There’s a Win32[2] port too.

1: [libarchive](http://people.freebsd.org/~kientzle/libarchive/)  
2: [LibArchive for Windows](http://gnuwin32.sourceforge.net/packages/libarchive.htm)
