Use find:

find . -exec gunzip '{}' +

or you can look explicitly for files that have not been gunzipped yet:

find . -name \*.gz -exec gunzip '{}' +

Those will do it for everything in the current directory and below. If you want to restrict it to the current directory, add -maxdepth 1 to the options.

The single quotes around the braces are so that spaces in file and directory names are properly handled. That is why xargs will have issues when trying to solve problems like this.

Answer from Mark Adler on Stack Overflow
🌐
Setapp
setapp.com › how-to › open-tar-gz-file
How to unzip GZ files on Mac: My most used methods
April 2, 2026 - To do so, just double-click on the .gz file or right-click, go to Open With, and select Archive Utility. Unfortunately, while Archive Utility can unzip GZ files, it can’t zip them back into archives.
Discussions

Opening a .gz and Gzip archive on mac
Commander One is a good option since it has built-in support for .gz and Gzip files (it's a file manager). Here's the guide: https://ftp-mac.com/how-to-unzip-tgz-files-on-mac/ More on reddit.com
🌐 r/techsupport
15
12
August 25, 2022
linux - Unzip all gz files in all subdirectories in the terminal - Stack Overflow
Is there a way to unzip all gz files in the folder containing the zipfiles. When zip files are in subdirectories. A query for find -type f -name "*.gz" Gives results like this: ./datasets/auto/a... More on stackoverflow.com
🌐 stackoverflow.com
zip - Terminal - Unzip all .gz files in a folder without combining resulting files - Stack Overflow
I have a folder, TestFolder, that contains several .gz files. Each .gz file is a folder containing several sub-directories, with the deepest level of each .gz file containing 5 text files. For exam... More on stackoverflow.com
🌐 stackoverflow.com
May 13, 2021
how to extract a gz file - Apple Community
This file is a gz data file. Have downloaded the file onto my iMac (download folder) This file needs to be extracted or unzipped before being uploaded to my site, what ever the correct terminology is? Can I do this within my Mac environment or do I have to download a third party application, ... More on discussions.apple.com
🌐 discussions.apple.com
November 15, 2015
People also ask

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.
🌐
setapp.com
setapp.com › how-to › open-tar-gz-file
How to unzip GZ files on Mac: My most used methods
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.
🌐
setapp.com
setapp.com › how-to › open-tar-gz-file
How to unzip GZ files on Mac: My most used methods
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.
🌐
setapp.com
setapp.com › how-to › open-tar-gz-file
How to unzip GZ files on Mac: My most used methods
Top answer
1 of 4
70

How about just this?

$ gunzip *.txt.gz

gunzip will create a gunzipped file without the .gz suffix and remove the original file by default (see below for details). *.txt.gz will be expanded by your shell to all the files matching.

This last bit can get you into trouble if it expands to a very long list of files. In that case, try using find and -exec to do the job for you.


From the man page gzip(1):

gunzip takes a list of files on its command line and  replaces  each  file
whose  name  ends  with  .gz, -gz, .z, -z, or _z (ignoring case) and which
begins with the correct magic number with an uncompressed file without the
original  extension.

Note about 'original name'

gzip can store and restore the filename used at compression time. Even if you rename the compressed file, you can be surprised to find out it restores to the original name again.

From the gzip manpage:

By default, gzip keeps the original file name and timestamp in the compressed file. These are used when decompressing the file with the -N option. This is useful when the compressed file name was truncated or when the time stamp was not preserved after a file transfer.

And these file names stored in metadata can also be viewed with file:

$ echo "foo" > myfile_orig
$ gzip myfile_orig 
$ mv myfile_orig.gz myfile_new.gz 
$ file myfile_new.gz 
myfile_new.gz: gzip compressed data, was "myfile_orig", last modified: Mon Aug  5 08:46:39 2019, from Unix
$ gunzip myfile_new.gz        # gunzip without -N
$ ls myfile_*
myfile_new

$ rm myfile_*
$ echo "foo" > myfile_orig
$ gzip myfile_orig
$ mv myfile_orig.gz myfile_new.gz 
# gunzip with -N
$ gunzip -N myfile_new.gz     # gunzip with -N
$ ls myfile_*
myfile_orig
2 of 4
10

Use this command to gunzip (unzip gz files) all files in the current directory and keep the original ones:

gunzip -k *.gz
🌐
Magma
magma.maths.usyd.edu.au › magma › faq › extract
Unpacking .tar.gz, .tar, or .zip files
gunzip -c foo.tar.gz | tar xopf - The newly extracted files will be created in the current directory.
🌐
Quora
quora.com › What-is-the-Linux-command-to-untar-all-gz-files-in-a-directory
What is the Linux command to untar all .gz files in a directory? - Quora
Answer (1 of 3): As a friend of mine used to say : “There are many ways to skin a cat" You could use the asterisk like: [code]gunzip *.gz [/code]Or for tar.gz archives [code]tar xfz *.tar.gz [/code]You could also indicate the full path… But what if you have a direct ory full of stuff plus the...
Find elsewhere
🌐
Quora
quora.com › How-do-I-gzip-all-files-in-a-directory-on-a-Mac
How to gzip all files in a directory on a Mac - Quora
Answer (1 of 3): If you want to create an archive of the directory, see Paul Olaru's answer. If you want to gzip each file individually, from a term window you can do something like: [code]find /which/ever/directory/ -type f -print | while read -r file; do gzip "$file"; done [/code](can be all ...
🌐
TunesBro
tunesbro.com › extract-gz-file-on-mac.html
How to Extract or Unzip GZ File on macOS | TunesBro CleanGeeker
November 23, 2018 - For example, if your file is in ~/xyz/Documents, then type this command followed by Enter: cd ~/xyz/documents · Step 3. Now run the following command in the command line of Terminal: gunzip filename.gz · You must be in the same directory as the .gz file, or this command will not work.
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › open-gz-file-windows-mac-linux
How to Open Gz File - GeeksforGeeks
July 23, 2025 - This will extract the contents of the .tar.gz archive to the current directory. ... You can also use this feature if you have Nautilus, or Dolphin and extract .gz file as per your desired location. ... macOS supports GZ files natively through Terminal and the Archive Utility. Here’s how you can unzip GZ files on macOS:
🌐
Wikihow
wikihow.com › computers and electronics › software › file manipulation › how to unzip a gz file on any platform: 7 easy methods
How to Extract a GZ File on Windows, Linux, Mac, & Mobile
February 19, 2026 - To make sure you're in the right directory, use the command ls -a to list the files. ... Use gzip -d filename.gz to extract the files.
🌐
SS64
ss64.com › mac › gzip.html
GZIP Command: Compress or decompress files in macOS
-q --quiet Suppress all warnings. -r --recursive Travel the directory structure recursively. If any of the file names specified on the command line are directories, gzip will descend into the directory and compress all the files it finds there (or decompress them in the case of gunzip ).
🌐
GitHub
gist.github.com › kstreepy › a9800804c21367d5a8bde692318a18f5
For a given directory, unzip all .gz files in folder, save unzipped files in folder and deleted zipped files. A python solution for instances where you do not have access to PowerShell. · GitHub
For a given directory, unzip all .gz files in folder, save unzipped files in folder and deleted zipped files. A python solution for instances where you do not have access to PowerShell. - gz_extract.py
🌐
iLogr
ilogr.com › home › how to unzip / extract a .gz file in windows / macos / linux: a step-by-step guide
Guide: How to Unzip / Extract a .gz File in Windows, macOS, Linux
August 1, 2023 - Navigate to the Directory: Use ... to the directory where the Gz file is located. For example: ... Replace `filename.gz` with the actual name of your Gz file. Press Enter, and the file will be uncompressed. If there are multiple files within the Gz file, they will all be extracted. Unzipping Gz files is a straightforward process, whether you’re using Windows, macOS, or ...
🌐
Apple Community
discussions.apple.com › thread › 7338410
how to extract a gz file - Apple Community
November 15, 2015 - Otherwise you could download "The Unarchiver" from the Mac App Store. It's free, but it can only decompress files. Once installed you'll only have to double-click the *.gz file. ... You may have somehow got an odd setting when compressing with 7zip. If that is the case, then of course windows ...
🌐
MakeUseOf
makeuseof.com › home › technology explained › what is a gz file and how do you unzip it?
What Is a GZ File and How Do You Unzip It?
May 23, 2023 - There are popular options, like The Unarchiver or Keka (paid on the macOS App Store but free on the developer's site). Both apps support several other formats as well, including ZIP and RAR.