Pack and unpack in 7z format with a Mac#

First open the Terminal app and type in:

brew install p7zip

The program itself is called: '7z'

In Terminal you can type in:

man 7z

for further information. Please see below for a copy of the info, too.

For a smart handling, please type in:

cd <path of the folder, you want to work with>

for example:

cd folder

Even more smart is to just type in 'cd ' (please don't forget the blank after the letter d and then just drag & drop the folder with the archive inside to the actual cursor position! That saves you a lot of typing! :-)

Example for packing#

For packing a file or an archive, please type in:

7z a file.7z <path of the file>

file.7z is the name of the archive which will be created in 7z format with the suffix 7z.

<path of the file> must be the path on your Mac leading to the file and the file itself at the end, of course. The same is true when dealing with a folder.

Example for unpacking#

For unpacking a file or an archive, please type in:

7z x <path of the archive.7z>

The program will then unpack the file 'archive.7z' in the same folder.

Credits#

- Tomasz 'Kr0tki' Krasuski for telling us about the best packer available
- Carsten Strotmann for sharing the knowledge on how to do it on a Mac as smart as possible

References#

Infos from the Terminal app#

NAME

7z - A file archiver with highest compression ratio

SYNOPSIS

7z [adeltux] [-] [SWITCH] <ARCHIVE_NAME> <ARGUMENTS>...

DESCRIPTION

7-Zip is a file archiver with the highest compression ratio. The program supports 7z (that implements LZMA compression algorithm), ZIP, CAB, ARJ, GZIP, BZIP2, TAR, CPIO, RPM and DEB formats. Compression ratio in the new 7z format is 30-50 % better than ratio in ZIP format. 7z uses plugins to handle archives.

FUNCTION LETTERS

a Add

d Delete

e Extract

l List

t Test

u Update

x eXtract with full paths

SWITCHES

-ai[r[-|0]]{@listfile|!wildcard} Include archives

-ax[r[-|0]]{@listfile|!wildcard} :