Archive Utility can't open some gzipped text files based on their contents

Someone in another forum sleuthed this out. If you run Archive Utility in the terminal, it shows a more complete error message:

Error unarchiving Error Domain=NSPOSIXErrorDomain Code=79 "Inappropriate file type or format" (Missing type keyword in mtree specification) 

Turns out Archive Utility on Catalina is misdetecting text files as mtree files, which is a documented way to misconfigure libarchive (bug 1; bug 2).

This means, in addition to Archive Utility on 10.15.4 failing to decompress some simple text files like "hello", it will also do surprising things with text files that match the mtree format. For example, decompressing "hello type=dir" will create a directory that can only be deleted with sudo:

% echo "hello type=dir" | gzip > hello.txt.gz; open hello.txt.gz
% ls -l
total 8
d---------  2 jcushman  staff  64 Apr 20 09:36 hello
-rw-r--r--@ 1 jcushman  staff  35 Apr 20 09:36 hello.txt.gz

As the other answer mentioned this is a bug. You can use other utilities, e.g., https://theunarchiver.com/ and extract the contents of your gzipped file.

Easiest way is to install unarchiver and associate .gz files with it, and then open your gz file with unarchiver.


For anyone still having this issue and cannot update to a more recent OS, I was able to unzip my .gz files through in Terminal with:

gunzip '/path/to/file.gz'

I'm running macOS 10.15.7.

Source