Macs usually come with a built-in compression tool called the Archive Utility that zips and unzips files. However, because this tool has relatively basic functionalities, other Mac users opt to use third-party apps. A quick check at the Mac App Store even shows over 50 apps that can be used for zipping and unzipping files.
It turned out to be that the zip file was encrypted and Archive Utility (Default program to extract zip files in Mac) is unable to extra encrypted files. Try this: 1-Go to the Mac App Store. 2-Search for an app called 'The Unarchiver' and install it. 3- Right click on any zip file, select get info and change the default program to be opened. ZIP is an archive file format that supports lossless data compression. This file, like other archive file formats, is simply a collection of one or more files and/or folders but is compressed into a single file for easy transportation and compression.
Finally, make sure the zip file you are creating matches the name of your original file or folder (e.g., “example” and “example”), or else your Mac will fail to create the zip file. Once you hit enter from this command, you will be prompted to enter a password into Terminal. On your Mac, do any of the following: Compress a file or folder: Control-click it or tap it using two fingers, then choose Compress from the shortcut menu. If you compress a single item, the compressed file has the name of the original item with the.zip extension. If you compress multiple items at once, the compressed file is called Archive.zip.
But what is a zip file by the way?
What is a Zip File?
An archive file format, a Zip file is a collection of one or more files/folders that are compressed into one file for easier transfer and compression purposes. Despite it being a popular file format, many macOS users have reportedly encountered problems with it. According to them, they cannot unzip files in Mac because of the Unzip Error 22: Invalid Argument error message.
Now, before we discuss why the unzip error 22 happens in Macs and how to fix the unzip error 22: invalid argument issue, allow us to discuss everything you need to know about macOS file compression for you to better understand the process.
macOS File Compression
Don’t bother looking for the Archive Utility in the Applications folder because you can’t find it there. Apple intentionally hid it because it’s a core service of the operating system. And when you say core service, it is used by Apple and macOS app developers to enhance the capabilities and features of an application. For instance, Mac Mail uses the Archive Utility to compress and decompress mail attachments. Safari, on the other hand, uses it to decompress downloaded files.
What’s great about this utility is that you can use it without having to launch it. But if you have a number of files to compress and decompress, you can conveniently open it, and then drag and drop files to it. You can access it by going to System > Library > Core Services > Applications.
Zipping a File/Folder
Compressing a file/folder is a relatively easy process. Simply follow the steps below:
- Open the Finder utility.
- Find the file or folder that you want to compress.
- Right-click on it and choose Compress from the list of options that appear.
- You will know if you have successfully compressed the file if you see a new file with the name of the item next to the word The new item should be named Compress [Item Name].
During the compression process, the selected file/folder is compressed. But the original file/folder is left intact. The compressed file/folder version will be stored in the same folder as the original file and will have a .zip file extension.
Zipping Multiple Files/Folders
Compressing multiple files/folders on your Mac is similar to compressing a single file/folder. The only noticeable difference is the name of the zip file generated.
To zip multiple files/folders on your Mac, here’s what you should do:
- Go to the folder that contains the folders/files you want to compress.
- Select all the items you want to compress. Shift + Click to select a range of folders or files. CMD + Click to select non-adjacent items.
- Once you have made a selection, right-click on any of the items and choose Compress.
- At this point, you already have a zipped file ready. It should have the word Compress in its file name, followed by the number of items selected and the file extension .zip.
Unzipping a File/Folder
Unzipping a file/folder is as easy as zipping one. Simply double-click on the zip file and it will automatically decompress in the same folder where the compressed file is stored.
If the item you decompressed contains more than one file, the decompressed item should retain the name of the original file. If a file with the same name already exists in the current folder, the decompressed file will have a number added to its name.
In case you didn’t know, there is another way to unzip a file/folder. It involves using Terminal, a built-in Mac program.
To use Terminal to unzip a file/folder, follow these steps:
- Open Use Spotlight to search for it.
- Into the text field, input unzip.
- Drag and drop the zip file into Terminal.
- Hit Enter and the file will be unzipped.
Why You Cannot Unzip Files
As perfect as this utility may seem, there are times when you can’t unzip files on your Mac because error messages like the Unzip Error 22: Invalid Argument pop up out of nowhere. Why do they happen? Here are a few reasons:
- Corrupted File – If you downloaded the ZIP file in a browser, there is a chance that it becomes corrupted, especially if you have closed the website prior to the download completion. Even though the file is already in the Download folder, you simply cannot open and unzip the file.
- Large File Content – Another possible reason why error messages appear while unzipping files on your Mac is that the file contains a large file.
- Permissions – In some cases, file permissions keep you from unzipping files. To resolve this, you may have to use third-party software.
- System Junk – Though rare, junk files may trigger the appearance of error messages associated with the Archive Utility.
How to Fix the Unzip Error 22: Invalid Argument Error
Are you looking for ways to resolve the Unzip Error 22: Invalid Argument error that appears while unzipping files on your Mac? If that is the case, then we cannot suggest a direct fix. What we recommend that you do is to try to unzip files using Terminal or simply perform a quick PC scan as junk and suspicious files might be keeping you from unzipping the files.
Unzip files using Terminal.
If double-clicking the file doesn’t work, you can try to unzip it using the Terminal utility. Perhaps, the file is too large that the decompress feature of the Archive Utility cannot handle it.
Don’t worry, though, because unzipping files in Terminal is easy. Just follow the steps below:
- Hold the CMD key and press Space to open Spotlight.
- Into the search bar, input Terminal and hit Enter.
- Unzip the file using the command: unzip filename.zip
- Press Enter and the file will be unzipped.
Perform a quick PC scan.
Still cannot unzip files? Try to perform a quick PC scan. It is possible that junk files are messing with important and core system processes, preventing you from executing or running utilities like Archive.
To perform a quick scan on your Mac, use a third-party Mac Repair tool like Outbyte MacRepair. Once the tool is downloaded and installed on your Mac, scan your system for any junk files and delete them. It should be easy-peasy!
Summary
Unzipping files on a Mac is easy as pie. All you need to do is double-click on the file and that’s it! The Archive Utility will take care of everything for you. However, if you fail to unzip files because of the Unzip Error 22: Invalid Argument issue, don’t panic. You can always try unzipping files using Terminal or just run a quick PC scan.
Do you know other ways to unzip files on a Mac? Share them below!
See more information about Outbyte and uninstall instructions. Please review EULA and Privacy Policy.
Zipping files on Apple/Mac is a chore because of all the hidden files and folders added by macOS. Like .DS_Store
and __MACOSX
are two of the most common files and folders that are added to zip files when compressed on macOS.
The folder named __MACOSX
especially is problematic because it contains duplicates of every file in the zip archive. So for example, if you use Finder to compress 20 files, the resulting zip file will contain the original 20 files, plus an additional 20 files all hidden under the /__MACOSX/
folder.
It’s a real pain and can be confusing to deal with because when you unzip the files on a Mac, the hidden files and folders are not included in the unzipped files. So you won’t be able to view them, even after you enable display of hidden files. The only way to view all the hidden files/folders is to open the zip file on a non-Mac machine, like PC/Windows or Linux.
Hidden Files
Phstat Apk
Here are some screenshots showing the hidden files and folders that are included for any folder compressed (zipped) on macOS. First screenshot shows the hidden __MACOSX
directory, which is visible on PC when you open the zip file.
The next screenshot shows the set of duplicate files and folders that are included in zip files compressed on macOS. Notice the file names, each begin with a dot .
, which makes the files hidden by default on most systems.
Now compare those previous screenshots (taken on PC) with the following screenshot (taken on Mac). Even with “show hidden files” enabled, the hidden __MACOSX
folder and all the hidden files are not included (i.e., they do not exist hidden or otherwise) in the unzipped archive.
So again, all the hidden files/folders added by Mac are included in the unzipped files ONLY when the files are unzipped on non-Mac machines. Thus the confusion: Why on earth are the hidden files added in the first place? They are completely excluded when unzipping on Mac, and never needed for any reason on any other machine. In fact quite the opposite: the hidden files serve NO purpose other than to waste bandwidth, time, energy, resources, etc.
Why does macOS include hidden files in zip archives? It makes absolutely zero sense.
Phstat Zip Archive File For Mac Os
Real Problems
This is a real problem because many people use Mac to zip files to share on the Web. Problem is that not everyone uses a Mac. So anyone downloading your zip files on their Windows, Linux, or other non-Mac is going to see all those hidden files and folders. Which are utterly useless to non-Mac devices and users.
Further, by adding a duplicate set of hidden files to the zip archive, Mac essentially is doubling the size of the download zip file, which of course wastes bandwidth, disk space, and everything else. May not be a huge deal for smaller zip files, but we’re talking about potentially millions or billions of zip files downloaded every day, needlessly bloated with useless data.
__MACOSX
directory and its duplicate set of files can cause problems with things like installing WordPress plugins and other applications. So if you are WordPress/Web developer, use a version-control system to manage and package/zip your files. That way you keep all the hidden junk completely out of the picture. Alternately if you aren’t using version control, you can remove/exclude unwanted hidden files using one of the techniques below.Real Solutions
Fortunately, all the hidden garbage is not needed on any machine — including Mac — so it’s all 100% totally safe to delete. So regardless of which machine/OS you are using, you can safely delete __MACOSX
and .DS_Store
from any zip archive. The files literally are useless. Read on to learn some different techniques for removing the __MACOSX
and .DS_Store
from ZIP Files on macOS.
Use software to exclude hidden files from NEW zip archives
For new files, you can use an app such as YemuZip or any free alternative to zip compress new files without any hidden junk.
I don’t know of any apps that can retroactively remove hidden files/folders from existing zip files. If you know of any, drop a comment or send via contact form.
Use command line to exclude hidden files from NEW zip archives
On Mac you can use Terminal to easily remove all of the hidden files/folders from existing zip files. Here are some techniques that I use for my own projects.
When creating new ZIP archives, you can use the zip
command to compress/zip files without any hidden files like .DS_Store
and __MACOSX
. Here are the steps:
- Open the Terminal app
- Navigate to the folder that contains the files you want to zip
- Type or paste the following command into Terminal*:
- Press Enter to execute and done.
The resulting zip archive will be named data.zip
and located in the same directory as the original uncompressed files. The data.zip
archive will not include any __MACOSX
or “dot-hidden” files (i.e., file names that begin with a literal dot).
*Important: The above command will remove all dot-hidden files, including files like .htaccess and other common/useful files. So if you want to keep some hidden files and only remove the ones added by macOS, use this command instead:
cd
and ls
commands to navigate in Terminal.Example
To give this a real-world example. Let’s say you have a folder on your desktop called Folder
that includes a bunch of files that you want to zip/compress.
First, open terminal and write following commands:
Now you have a file called data.zip
on your desktop that does not include any __MACOSX
or .DS_Store
files. I.e., a nice clean zip file with no hidden garbage.
Use command line to remove hidden files from EXISTING zip archives
Phstat Zip Archive File For Mac Osx
The above techniques show how to exclude hidden files when creating new zip archives. But what if you want to remove hidden files from an existing zip archive? Easy. In Terminal, navigate to the directory that contains your zip file and enter the following two commands:
And/or if you have multiple zip archives in some folder, and want to remove all hidden macOS files from all of them in bulk. Use Terminal to navigate to the folder and enter the following commands:
I use this technique for zip files I serve here at Perishable Press and elsewhere.
Tip
For a “quieter” Terminal experience, you can add the q
(quiet) or qq
(quieter) parameter to the previous bulk-delete command:
Cheers people.