If you’ve ever download large packages of files split up into a batch of RAR files, you may have had the situation where the RAR can’t be expanded due to an error.

If all the files are complete they should have the same number of bytes (except the last file which will likely be smaller than the others), then it is possible some data was corrupted.

RAR files usually contain a repair segment within them. They also contain error checking data (CRC data) in them. This means you can test an RAR file for corruption, and it means you can often repair a RAR file that won’t extract. Of course if any of the files in  batch are incomplete a repair won’t be possible. If the files are exactly 100 MB each, and you have one in the batch that is say 99.999 MB then the file is complete. You may be able to resume the download or you may have to re-download that file. If, however, the files are all complete but one or more have errors, they could likely be repaired.

Here’s how to do it.

Step 1

Follow the instructions in this article to install RAR and UNRAR.

Step 2

Follow the instructions in this article to test the archive for possible damage / corruption. After that, you will have now identified which files in the archive set or batch are damaged.

Step 3

Run Terminal.app (type Terminal into Spotlight search).

With all the RAR and UNRAR commands, any time files will be generated you need to first change the active directory (in Terminal) to the location where you want the output files to go. So the first command (cd) in the following example is for that purpose.

Type in the following into Terminal at the command line:

Note, there is a space before and after the free-standing “r“. So it’s rar(space)r(space) – don’t hit enter just yet.

TIP: Also remember you can simply drag folders and files from Finder into Terminal and their full path will magically appear in Terminal. It saves having to type long paths and avoids making errors.

Go to finder and locate the first damaged file you found in the RAR test you performed in Step 2.

Grab the file in Finder and drag it to Terminal. You should now see the full path of the file appear after the rar r part you typed. It will look something like this:

Hit enter and watch RAR do its work. If the file is repaired you’ll see output along this lines of the following:

If you see “Done” and all the Sector lines say, “data recovered” at the end, then your file should be complete repaired. Nice, that’ll save you from having to download it again.

Once you’re done with the repair you may need to copy the repaired files into the folder with the rest of the RAR archive files. You will be prompted to replace the existing (damaged) files. Either rename them first, or move them, or simply let them be replaced with the repaired versions.

You’re now ready to do the extraction. You can use one of the many Mac GUI archive tools or you can do it in the command line using the instructions here in this past article.