How to unzip GZ files on Mac

217.4K views
8 min read

Most of us are familiar with ZIP files, and those who’ve used Windows would recognize RAR files as well. Both of those are popular archiving formats, frequently used to compress files and folders, and easily send them out without compromising their integrity. 

Naturally, .zip and .rar are not the only archives available. If you use Mac or Linux, eventually you’ll encounter .z or .gz files as well.

What is a GZ file? The GZ (or GZIP) archive format was created by Jean-loup Gailly and Mark Adler, two software developers, back in 1992 who used the GNU Gzip compression algorithm to improve on the default compression process in UNIX. That’s why you most often see .gz files in macOS and Linux systems. 

A unique feature of .gz files is that they can only contain one item each (unlike .zip or .rar). To combine multiple files under .gz format, you need to first use an archive utility like TAR, which would create a special .tar.gz or .tgz file format. 

Where to unzip

Here’s how

On Mac

Double-click on the .gz file > Open With > Archive Utility.

On Terminal (Mac)

Drag and drop your file onto the Terminal’s window.

  • To unzip, type gzip -d file.gz. 
  • To keep original file, type gzip -dk file.gz.
  • To extract archived folder, type tar -xf file.tar.gz

In Archiver

Install and open the app > drag/  and drop your archive > Preview with Space > Extract.

In BetterZip

Install and open the app > drag and drop your file > Preview with Space > Extract.

Let’s see why you might want to use .gz files, how to open gz files on Mac, and how to extract .gz archives as well as create your own.

Why Use GZ Archives?

GZ or GZIP is still a widely used compression algorithm because it helps reduce the size of a file considerably while protecting its integrity. Importantly, GZIP compression doesn’t strip out the original file name, ownership, or timestamp. The latter is especially handy when working with files that can easily get truncated in transfer. 

Today, you also often see .gz files being used in web development to compress web elements and make webpages load faster. 

So how do you create and extract .gz archives on your Mac? You have a few options to do that.

How to open GZ files on Mac

While Windows users have to install additional apps and extensions to open GZ files, Mac users can do so by default. 

Archive Utility, for example, which is Mac’s default archiving app (with no user interface) can easily extract .gz archives at any time. To do so, just double-click on the .gz file or right-click, go to Open With, and select Archive Utility. 

Open GZ with Archive Utility

Unfortunately, while Archive Utility can unzip GZ files, it can’t zip them back into archives. For that, you need to either use Terminal or third-party software.

How to unzip GZ files with Terminal

Since .gz file format was originally created to make archiving better on UNIX systems, it can also be controlled by Mac’s command line — Terminal.

Terminal is very powerful, letting you do any action on your Mac without the graphical user interface. But it’s also quite unforgiving, since it’s very easy to do something very wrong. That’s why most people try to avoid it. 

To safely extract .gz files, you can use Terminal’s gzip or gunzip commands. But, first, make sure that your terminal state is in the same folder and the files about to be zipped. You can use the ls -la command to print the files in the current folder and then navigate inside folders with the cd command or step back with the cd - command. 

Alternatively, you can just also drag and drop your file onto the Terminal’s window. 

To unzip GZ files, use: gzip -d file.gz (where file.gz is the path to your file). For simpler syntax, you can also use gunzip to replace gzip -d, so type: gunzip file.gz

extract gzip with Terminal commands

These commands will also remove the original file. To unzip GZ and keep the original file, use: gzip -dk file.gz

If you’re actually trying to extract a folder archive like .tar.gz, the Terminal command is a bit different: tar -xf file.tar.gz

unzip tar.gz archives with Terminal commands

All of the commands above will extract files in the same directory as the original archive. You can also now see why most people avoid using Terminal, it works like magic but, at the same time, it’s hard to understand how. Luckily, there are a few more powerful and user-friendly options you can turn to.

How to extract .gz archives with third-party apps

If you’re looking for fast and easy options to unzip GZ files, you should start with Archiver. 

Archiver is a lightweight archiving utility that is blazing fast and supports all the archiving formats you’ll ever meet in your life. Its interface is so intuitive that you barely have to do anything, just follow a few prompts to either create or unpack an archive at any time. 

Moreover, you can extract files out of the same archived folder selectively and preview them with Quick Look. You can also set passwords, combine a few archives together, or split large archives into equal parts. 

To unzip GZ file with Archiver: 

  1. Launch Archiver
  2. Drag and drop your archive onto the app
  3. Use Space to preview your file in Quick Look
  4. Click Extract

unzip GZ file with Archiver

Similarly, to create an archive like .tar.gz, you can use the Convert feature in Archiver and choose TAR.GZ among the options. Then click Convert. 

create an tar.gz on Mac

How to extract a specific file from a tar archive?

BetterZip is another powerful archive manager. It lets you browse and manage archives without even unarchiving them in the first place! So you can preview, rename, edit, and delete files right within the app. 

In addition, BetterZip is a breeze to zip and extract more than 30 archive formats, install passwords, and even automate any archiving functionality with AppleScript.  

To extract a specific file from a gzip-compressed archive with BetterZip: 

  1. Launch BetterZip
  2. Drag and drop your file onto the app
  3. Preview with Space to launch Quick Look, if needed
  4. Click Extract in the top menu

extract a specific file from a tar.gz archive

As you can see, there’s no shortage of ways to create and open GZ files. For the most basic functionality, the default Archive Utility will suffice. For the most advanced users, learning a few Terminal commands could be helpful. But most people should probably try Archiver as the easiest way to unarchive files or BetterZip as the most flexible archiving solution on the market. 

Best of all, Archiver and BetterZip are both available to you absolutely free for seven days through the trial of Setapp, a platform with more than 210 best-in-class Mac apps that cover any app category possible, from managing your daily tasks (2Do) to creating text templates for repeating messages (Rocket Typist). Try every Setapp app at no cost today and download dozens of wonderful apps to skyrocket your productivity.

FAQ

What is a .gz file on Mac?

A .gz file, or GZIP file, is a compressed file format primarily used on UNIX systems to reduce file size. It typically compresses a single file, unlike ZIP archives, which can contain multiple files. On macOS, .gz files are often used for data compression and software distribution.

What software do I need to unzip .gz files?

You can use the built-in Archive Utility on macOS for basic extraction of .gz files. For more advanced features or support for additional formats, consider third-party apps like Archiver and BetterZip. These applications provide a more user-friendly interface and extra functionality.

Does tar.gz work on Mac?

Yes, this format uses TAR to bundle multiple files into a single archive and then applies GZIP compression. You can extract .tar.gz files using Terminal commands like tar -xf file.tar.gz or through third-party tools such as Archiver and BetterZip.

How can I open a .gz file for free?

You can open .gz files for free using macOS's built-in Archive Utility. Simply double-click the .gz file and choose Open With > Archive Utility. Additionally, use third-party apps like Archiver to extract .gz files easily.

250+ apps for $9.99
per month

Sign up to Setapp and try them for free.

Security-tested