I wanted to get something that would work equally on Linux, macOS, Windows and the BSDs, so I wrapped a pure-Go (no C/C++) library with a CLI: runzip
https://github.com/therootcompany/runzip
Usage
USAGE
runzip <archive.rar> [./dst/]
EXAMPLES
runzip ./archive.rar # ./inner-dir/
runzip ./archive.rar ./existing-dir/ # ./existing-dir/inner-dir/
runzip ./archive.rar ./new-dir/ # ./new-dir/
Install
Distributed via GitHub Releases: https://github.com/therootcompany/runzip/releases
And Webi:
curl -sS https://webi.sh/runzip | sh
source ~/.config/envman/PATH.env
curl.exe -sS https://webi.ms/runzip | powershell
But... Why!?
Well, mostly because I use macOS as my daily-driver and I just don't like the idea of having to first install 500mb of brew to get the unrar command. And I like having tools that work just as well on Windows as on *nix.
That's not really a problem on Linux, HOWEVER, runzip does have one small advantage on all platforms:
It detects whether or not the folder you selected to extract to exists and whether there are multiple items or just a single item in the archive, and ensures that there is exactly one containing folder.
# unpacks to ./existing-folder/internal-name/ or ./existing-folder/archive/
runzip ./archive.rar ./existing-folder
unpacks to ./new-folder/, possibly denesting the containing folder
runzip ./archive.rar ./new-folder
Also, it's BSD-licensed.
There's no fame or fortune to be had here, but if it had existed I wouldn't have made it, so I'll drop it here for posterity.