How to compress and uncompress files and folders in OSX 10.9 Mavericks using Terminal

Since OSX is based on Unix there are a lot of ways to compress files and folders, below are a few options using the command line interface. The default command line application interface in OSX is the Terminal and stored in /Applications/Utilities


We should always compress files and folders to save on file size and ensure the contents are captured and delivered or stored as one monolithic file. A compressed file which contains files and folders is generally referred to as an archive.

ZIP – Cross Platform: ZIP is one of the most commonly used compression techniques used across all platforms.

To compress:
# zip -r folder_to_compress

To Uncompress: 
# unzip

If you want to make a zip without those invisible Mac resource files such as “_MACOSX” or “._Filename” and .ds store files, use the “-X” option in the command so:

# zip -r -X folder_to_compress

TAR.GZ – Cross Platform: