Not able to extract any .gz or .tar file (Mac OS X 10.5.8)

Solution 1:

Does it work from a terminal for tgz files? Open a terminal and cd to the folder that has the files and try something like this:

tar xvzf file.tar.gz

Or for plain tar files:

tar xvf file.tar

Solution 2:

There may be too many NUL blocks at the end of the tar file, so that the tar command prematurely finishes its executions (and closes its standard input) after having received two NUL blocks while the gunzip command is still trying to write to the pipe that now has no reader anymore (which raises an EPIPEerror message with error number 32 for a broken pipe; for more information see: Tar-filled pipes).

According to the output of newproc.d Archive Utility.app seems to use the following commands (Mac OS X uses bsdtar by default):

/usr/bin/gunzip -c file.tar.gz | /usr/bin/tar xf - -C dir

To see the number of trailing NUL blocks in the tar file use:

gnutar -tzf file.tar.gz -i --block-number | nl | tail -n 25

To extract the tar archive try:

# -i: ignore blocks of zeros in archive (normally mean EOF)
gnutar -i -xvf file.tar.gz

.zip files can be tested with:

unzip -lv file.zip
unzip -t file.zip