How to compile pdfcrack on a Mac?
July 1, 2011 9:28 AM   Subscribe

Can you walk me through compiling this sourceforge source (pdfcrack) on a Mac?

I'm not sure if it's possible, but I need to compile the sourceforge app pdfcrack on a Mac. I have very basic terminal knowledge but don't know if I need to install anything in advance or how to compile it. I'm on 10.5.8 if it matters.
posted by sharkfu to Computers & Internet (6 answers total) 4 users marked this as a favorite
 
Looks like pdfcrack is written in C and comes with a Makefile. According to the README, you don't need any libraries, so you really only need a C compiler, like GCC. What happens if you navigate to the directory with your (unzipped) files, and type 'make'?
posted by segfault at 9:47 AM on July 1, 2011


I can confirm it compiles with a simple "make" on 10.6.8 with the developer tools installed.
posted by rickim at 9:59 AM on July 1, 2011


You'll need to install Xcode first, of course, to get make and the C compiler.
posted by zsazsa at 10:02 AM on July 1, 2011


Do you have xcode installed? If you don't, install it -- it should be on the OS cd that came with your computer at least. Apple has made it a real pain in the ass to download it now and I'm not sure what you need to do.

download pdfcrack-0.11 from sourceforge and put it on to your desktop. Open terminal.app (in Applications > Utilites) and type `cd desktop` and then enter. `cd` stands for "change directory" --your 'working directory' is now your desktop.

To unzip the file, type `tar xzvf pdfcrack-0.11.tar.gz` and `cd pdfcrack-0.11`. Finally, type `make`. This command follows a list of instructions in the file "makefile" to compile the program for your machine.

You can look in the directory straight from your desktop now and see a new file called "pdfcrack". That's the executable. Now you need to run that with your pdf file as a command line argument. Type `./pdfcrack ` (note the space) and drag and drop your pdf file onto the terminal. Press enter. You should get back a list of things with "found user-password:" and then the password at the end.
posted by wayland at 10:02 AM on July 1, 2011


Oh, I just realized homebrew has a pdfcrack formula. It's a package manager for os x and makes compiling and installing much simpler. It'll also keep track of dependencies and versions for you. Maybe it's overkill if you're installing just one thing, but if you plan on doing more, I'd recommend it.

You still need Xcode, though, but it's recommended to install after homebrew. To install homebrew, type `/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"` and enter. Follow along with the instructions and then install Xcode.

Then just type `brew install pdfcrack`. Now you can just do `pdfcrack ` followed by the absolute or relative path name of your pdf. You could also do that trick I mentioned earlier of dragging and dropping your file into the terminal.

Homebrew is really handy if you want to install pretty much any command line tools. You can do `brew search n` to see if it has a formula (and could then install) n, `brew install n` to install it, and brew `brew uninstall n` to get rid of it. If you want to update everything, do `brew update`and then `brew upgrade`.
posted by wayland at 10:13 AM on July 1, 2011


wayland's right; the easiest way to simply use open-source software on a Mac is to use something like homebrew or (my personal preference) MacPorts. The third option I know of is Fink. In every case, though, you'll need to download and install Apple's Developer Tools package (this used to be a lot easier than it is now).
posted by hattifattener at 12:07 PM on July 1, 2011


« Older Where is the perfect weather?   |   Preppy, on the cheap Newer »
This thread is closed to new comments.