Macos – How to compile Rarcrack for Mac OSX

macmacosterminal.appxcode

I have a rar I desperately need whose password was saved as a file on a site that no longer exists :(.

I'm running it on a mac osx 10.5.8 and have never used the terminal before but I figured out enough to get up to the point where it says use 'make' and it always gives an error.

-bash: make:command not found

I did figure out how to use the terminal to extract the tar file though ^_^

I didn't understand what the requirements were so I decided to get a C compiler which it says is necessary, so I installed Tiny C Compiler and then tried to install a version of glibc newer than 2.4 (at least that's how I understood the > glibc 2.4 requirement!) but it kept giving me an error in the console every time I tried to configure it saying something like there is no compiler.

Where do I go from here? After a little research I found this link to install GCC which is also a compiler I assume? I don't even know what to get from the link…. From what little I know of regex and POSIX, pthreads are just posix threads and since I'm running a mac I shouldn't have to download or install anything right? I also have to install libxml2 which I found here. Do I install that the same way as glibc?

Sorry that is a lot of questions actually 🙁

Also sorry I can't pull up the exact errors because I am at work, not my home computer.

Best Answer

On Mac OS X, Apple distributes a custom build of the GCC (GNU Compiler Collection) toolchain alongside their Integrated Development Environment (IDE) known as XCode.

XCode is a graphical user interface that can be used to build some software which supports XCode's build system. However, it is not necessary to use XCode itself in order to use the version of GCC which is installed along with XCode. Think of XCode as an optional graphical front-end to GCC, which is only necessary if you are trying to compile a project that is designed to be built with XCode.

The GCC compiler that Apple ships with XCode supports a number of native programming languages. One of them is C. So that solves your C compiler issue.

Once you install XCode, you should be able to run the gcc command from the Terminal without doing anything else. Try it; just run gcc. It should say:

gcc: no input files

or something similar to that. If it says that, then you know you're at least making progress; now, you have a C compiler.

And don't install or worry about Tiny C Compiler.

Once you have gcc installed, running make should at least get you a bit further. If rarcrack's build system complains that you don't have certain dependencies installed, you will have to compile those dependencies from source, or install pre-built development libraries for them.

There are a number of ways that the build system may try to tell you that you're missing a dependency library, and some of them are fairly cryptic messages such as "undefined symbol blah blah" or ": No such file or directory". If you see these kinds of errors, it's usually the compiler trying to tell you that you're missing a dependency; by contrast, a more friendly build system (which rarcrack appears not to have) would gracefully complain with something like:

Checking for LIBXML2... no

There are limitless possibilities as to what may go wrong, but learning to recognize patterns in error messages and analyze them, or at the very least posting exact error messages when you ask questions on SuperUser / StackOverflow, will get you much further.

As for rarcrack itself, it depends on GLib 2.0. Well, not exactly version 2.0, but any version that at least begins with a "2" in front of it. So it would work as well with the latest stable release of the "2.x series" as it would with an earlier version. In other words, you want to use the latest possible version of GLib that you can find in the 2.x series. That'd be this one: here is the download for the GLib "2.32 series". You want to download the one that it says is the latest, which, as of this writing is 2.32.4. If there's a 2.32.5 or later out when you read this, grab that instead. You might also want to look at the 2.34 series if you are reading this after that comes out (don't use odd numbered series if you want to avoid pain, because those are unstable releases).

GLib, unfortunately, depends on lots of stuff, so you'll have to hope to find existing builds of GLib and all of its dependencies, or else compile all of them from source. But instead of compiling from source, maybe checkout Macports or Fink to give you the binaries pain-free.

Related Question