RAR, 7z and tar.gz archives on a Mac, and which ones Finder refuses
Double-clicking a .zip on a Mac expands it. Double-clicking a .rar does nothing useful. .7z behaves the same way, and .tar.gz sometimes works and sometimes produces an intermediate file that needs unpacking again.
The Finder’s Archive Utility handles a specific list and quietly declines everything else. Knowing the list saves a lot of guessing.
What macOS opens by itself
Archive Utility handles ZIP, gzip, bzip2, tar and their combinations. So .zip, .tar, .tar.gz, .tgz, .tar.bz2 and .gz all work by double-clicking.
It does not handle RAR or 7z. Those are separate formats with their own compression, and macOS has never shipped support for either.
The tar command covers more than the Finder
Before installing anything, note that the built-in tar handles the whole tar family and is more predictable than double-clicking, particularly for the two-stage formats:
tar -xzf archive.tar.gz # gzip
tar -xjf archive.tar.bz2 # bzip2
tar -xJf archive.tar.xz # xz
tar -xf archive.tar # plain
-x extracts, -f names the file, and the middle letter selects decompression. Modern tar on macOS detects the compression automatically, so tar -xf archive.tar.gz usually works regardless.
To see what is inside before extracting, which is a good habit with anything from elsewhere:
tar -tf archive.tar.gz | head -20
To extract into a specific directory rather than the current one:
mkdir unpacked && tar -xf archive.tar.gz -C unpacked
That last one is worth doing by default. Some archives contain a single top-level folder and some scatter their contents, and extracting into a fresh directory avoids the second kind spraying files across your Downloads folder.
The double extension
.tar.gz confuses people because it is two operations: tar bundles many files into one, gzip compresses the result. Double-clicking in the Finder sometimes performs only the gzip step, leaving a .tar file behind that needs opening again.
tar -xzf does both in one pass, which is why the command is more convenient than the Finder here despite being a command.
7z
macOS does not include 7z support. If you have Homebrew:
brew install p7zip
7z x archive.7z
7z x extracts preserving directory structure. 7z l lists contents without extracting.
Without Homebrew, one of the several archive utilities on the App Store handles it, or the sender can re-send as ZIP.
RAR
RAR is proprietary, and that is the reason nothing on a Mac opens it out of the box. The compression is patented and the reference implementation is not freely redistributable, so it does not ship with operating systems.
With Homebrew:
brew install carbon-copy-cloner-free-unar 2>/dev/null || brew install unar
unar archive.rar
unar handles RAR along with a wide range of other formats and is the most generally useful of the command-line options. lsar archive.rar lists contents without extracting.
Multi-part RAR archives (.part1.rar, .part2.rar, and so on) need every part present in the same folder. Point the tool at the first part and it finds the rest:
unar archive.part1.rar
A missing part means an incomplete extraction. There is no working around it; the data is in the part you do not have.
When the archive is damaged
An archive that will not extract may be truncated rather than unsupported, and the two look similar from the outside.
For ZIP, test it directly:
unzip -t archive.zip
No errors detected in compressed data means the archive is sound. Errors name the entries that failed, which tells you how much is recoverable.
Extract what survives rather than giving up on the whole thing:
unzip -o archive.zip -d recovered 2>&1 | tail -20
unzip recovers the entries it can read and reports the ones it cannot. For an archive damaged near the end, that is often nearly everything.
Compare the file size against what you expected. Archives are usually damaged by incomplete downloads, and a truncated file is a transfer problem rather than an archive problem. Re-downloading is faster and produces a better result than any repair. For large downloads over an unreliable connection:
curl -C - -O "https://example.com/large-archive.zip"
-C - resumes where an interrupted download stopped.
Manatee reads what survives in a damaged archive and writes a clean copy containing the recoverable entries, working from a duplicate so the original is never altered by the attempt. It reports what came back rather than declaring success on an archive that still will not open. How to fix a corrupted ZIP archive goes through that in more detail, and why files get corrupted covers what is realistically recoverable.
Creating archives others can open
If you are sending rather than receiving, ZIP is the format with no friction anywhere:
zip -r archive.zip FolderName
To exclude the macOS metadata files that otherwise clutter the archive on Windows machines:
zip -r -X archive.zip FolderName -x "*.DS_Store" -x "__MACOSX/*"
The Finder’s own Compress command produces a ZIP too, and includes those extra entries, which is harmless and looks untidy to recipients on other platforms.
Questions
Why does my .tar.gz leave a .tar behind?
Archive Utility performed only the decompression step. Use tar -xzf to do both at once.
Is 7z better than ZIP? It compresses more tightly. Whether that is worth the recipient needing extra software depends entirely on who you are sending to. For general distribution, ZIP.
The RAR extracts but files are missing.
Check for missing parts of a multi-part archive, or a password-protected archive that partially extracted. lsar lists what should be there.
Can I open a RAR without installing anything? Not with the tools macOS ships. Ask for a ZIP, or use a web-based extractor only if the contents are not sensitive, since that means uploading them to someone else’s server.