Unrar on a RaspberryPi running Raspbian

To my surprise I found that there’s no usable unrar command on my RaspberryPi.
I run Raspbian on it and it so happens that I wanted to unpack a rather large rar file.
The unrar-free package is not good enough for some archives, so that is not an option.

So how to get a working unrar on a Raspbian 8.0? And do you really need it?

Well, there are 2 options that I found, either you use 7zip or if you really want the unrar command, you can build it from Debian source package.

First, let’s look at the building from source package approach.

Enable usage of src packages by adding/uncommenting

deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

in your /etc/apt/sources.list

Afterwards download all the dependencies and build the unrar package:

apt-get build-dep unrar-nonfree
apt-get source -b unrar-nonfree

This will leave you with a fresh unrar package, in my case: unrar_5.2.7-0.1_armhf.deb which you can now install:

sudo dpkg -i unrar_5.2.7-0.1_armhf.deb

And indeed now you have a working unrar command.

There is, however a much easier way too – use 7zip 🙂

Install  the p7zip-full package and it will provide 7z command, which you can use to unpack your oh so important rar files like so:

7z x something.super.important.rar

But which one is faster you might ask?

I did compare both by unarchiving the same file several times and it appears that unrar is about 10-15% faster.
So if you expect to be doing lots of unarchiving, building your own unrar might be worth the effort.