Install bzip2 to handle some UNIX archives

Jun 13, '02 12:26:31AM

Contributed by: vipm

Sometimes when you download UN*X/Linux stuff from the net for use with MacOSX, they files are compressed using bzip2. Unfortunately, bzip2 doesn't come standard on MacOSX (as far as I know). So to unzip in the Terminal, you have to install bzip2.

I had to do this when I downloaded the PHP manual and it was compressed as bzip2. I wanted to uncompress in the Terminal so that the long file names would be retained -- sometimes uncompressing using Stuffit Expander clips the long file names.

Anyway, if you need to install bzip2 so you can uncompress on MacOSX's Terminal, read the rest of the article for the instructions...

First get the bzip source code.

To compile on MacOSX (assuming you've installed Developer CD):

  1. Copy the bzip2-1.0.2.tar.gz file to /usr/local and uncompress:
    gzip -dc bzip2-1.0.2.tar.gz | tar xvf -
  2. Modify the Makefile and change "CC=gcc"
    to "CC=cc"

  3. Do a make: /usr/local/bzip2-1.0.2/make

  4. Do a make install: /usr/local/bzip2-1.0.2/make install; this installs bzip2 into /usr/bin

  5. delete the directory created as well as the zip file:
    % cd ..
    % rm -f -r bzip2-1.0.2.tar.gz
    % rm -f -r bzip2-1.0.2
To use bzip2, go to the directory you want to un-bzip, and then use "bunzip2" for example:
bunzip2 php_manual_en.tar.bz2
To get help of how to use bzip:
/usr/bin/bzip2 --help
[Editor's note: If you have fink installed, you can install bzip2 with a simple sudo fink install bzip2.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020613002631675