To extract a TAR file on a Mac without uploading it, first inspect the archive in a separate folder, then use macOS’s tar command with the correct compression flag or a local archive utility. A .tar is an archive container; .tar.gz, .tar.bz2, and .tar.xz add compression. Never extract an untrusted archive into a working folder.
Short answer
TAR is short for Tape Archive. A plain .tar file bundles files and folders but does not compress them. Extensions such as .tar.gz and .tar.xz mean that the TAR bundle was compressed after it was created. The suffix tells you which extraction option to use.
The safest workflow is to list the archive contents first, create a new destination folder, extract into that folder, and inspect the result before moving anything into a project or system directory. This keeps the archive unchanged and gives you a clear place to remove the extracted files if they are not needed.
What you need
- A Mac with enough free space for both the archive and the extracted files.
- The exact filename and extension, including whether it ends in
.gz,.bz2, or.xz. - A destination folder that is not your Desktop, Documents, or an application folder containing active work.
- A backup or another copy of important files before replacing anything.
You do not need to upload the archive to a website. Terminal is included with macOS, and a local archive utility can provide a graphical preview. If the archive came from an unknown source, treat its contents as untrusted until you have inspected them.
Step 1: Identify the archive type
Look at the complete filename in Finder. Common examples are:
project.tar— an uncompressed TAR archive.project.tar.gzorproject.tgz— TAR compressed with gzip.project.tar.bz2— TAR compressed with bzip2.project.tar.xz— TAR compressed with xz.
Do not remove an extension just to make the file look simpler. The extension is a useful record of how the archive was packaged and helps you choose the correct command.
Step 2: List the contents before extracting
Open Terminal from Applications > Utilities. Change to the folder containing the archive, or type tar followed by the full path. Quoting the path is useful when a filename contains spaces.
For a plain TAR file, list its members with:
tar -tf "project.tar"
For compressed variants, add the matching flag:
tar -tzf "project.tar.gz"
tar -tjf "project.tar.bz2"
tar -tJf "project.tar.xz"
The -t operation lists members, and -f tells tar which archive to read. The -z, -j, and -J flags tell it to decompress gzip, bzip2, and xz data respectively. If the listing contains unexpected paths, stop and investigate before extracting.
Step 3: Create a clean destination folder
Create a directory specifically for this archive. For example:
mkdir -p "project-extracted"
If you are currently in the folder that contains the archive, this creates a sibling directory for the output. You can also make the folder in Finder and drag its path into Terminal after typing the command. Avoid using sudo; an archive should not need administrator privileges merely to be unpacked into your home folder.
Step 4: Extract with the matching option
Use -x instead of -t to extract. The -C option sets the destination directory:
tar -xf "project.tar" -C "project-extracted"
tar -xzf "project.tar.gz" -C "project-extracted"
tar -xjf "project.tar.bz2" -C "project-extracted"
tar -xJf "project.tar.xz" -C "project-extracted"
These commands leave the original archive in place and write the members into the destination folder. GNU’s tar documentation describes extraction as retrieving members without modifying the archive, so you can repeat the operation if the first destination was wrong.
To extract only one member, first copy its exact path from the listing and add it after the archive name:
tar -xf "project.tar" -C "project-extracted" "docs/readme.txt"
Use the exact path shown by tar -tf; a leading directory name or capitalization difference can cause a “not found” message.
Step 5: Verify the result
Open the destination folder in Finder and check that the expected top-level folder and files are present. Compare a few filenames with the original listing. If the archive contains a checksum file, verify it according to the publisher’s instructions before using the extracted program or documents.
For an archive from the internet, keep the extracted files isolated until you know what they are. Do not double-click an unknown executable or installer merely because it was inside a familiar-looking archive. macOS security warnings are a reason to pause and verify the source, not an invitation to bypass them.
Important limitations and errors
“Not in gzip format.” You probably used -z on a plain .tar, or the filename does not match its contents. Re-list the file without a compression flag and check the publisher’s documentation.
“Cannot open: Permission denied.” Choose a folder inside your home directory, confirm that the destination is writable, and avoid changing permissions blindly.
Files appear in an unexpected nested folder. Many archives contain a top-level directory. That is normal; inspect it before moving its contents elsewhere.
The archive could overwrite existing files. GNU’s tar manual recommends creating a new directory and listing an untrusted archive before extraction. Never unpack an unknown archive directly into a folder containing originals.
A private local option
ArchiveZero is a native Mac utility whose current product page lists TAR, GZ, BZ2, and XZ support alongside ZIP, RAR, and 7Z. It can preview contents before extraction and batch-process archives locally. The page lists macOS 13.0 or later and a one-time $8 license; the free tier is limited by session usage. Use the preview first, then extract to a new folder. Review the ZeroApps refund policy before purchasing.
Frequently asked questions
Is a TAR file compressed?
Not by itself. TAR bundles files and directories. Compression is indicated by an additional suffix such as .gz, .bz2, or .xz, which changes the command option you need.
Which command opens a .tar.gz file?
Use tar -xzf "file.tar.gz" -C "destination". The -x extracts, -z handles gzip compression, and -f identifies the archive file.
Can I extract one file instead of the entire archive?
Yes. List the archive first with tar -tf, then pass the exact member path after the archive name in the extraction command. Extract it into a separate directory so you can review it.
Why did double-clicking the TAR file do nothing?
Finder’s archive handling varies by format and macOS version. Terminal gives you an explicit command for each compression type, while a local utility can show whether the archive is supported before extraction.
Should I extract an archive directly into Downloads?
It is safer to create a dedicated folder. This prevents an archive from overwriting files with the same names and makes it easier to delete the extracted set if it is not trustworthy or no longer needed.
Sources
- GNU tar manual: How to Extract Members from an Archive
- GNU tar manual: Extracting Archives from Untrusted Sources
- GNU tar manual: Operations
Last reviewed: 2026-08-17
Suggested tags: macos, tar, archives, file-management
Related app: archivezero