Pdftk 1.41 for Intel Macs

Pdftk is a useful utility for manipulating PDF files. A Macintosh binary of the current version was not available, except perhaps from Fink or Darwin Ports, so I built it myself. My version is not universal, but it doesn’t require a package manager, either.

Until such time as this binary is available directly from the official pdftk site, you can get it here:

Download pdftk 1.41 for Intel Macs 1MB

Note: the default pdftk Makefile settings result in a binary that still relies on gcj. Until such time as this issue is resolved, the binary probably won’t be much use!


Building pdftk requires gcj, which comes with gcc, but apparently not with Mac OS X. So, I downloaded and built GCC 4.2.2. Why 4.2.2? Because it was the most recent version.

./configure --prefix=/usr/local/gcc/4.2.2 --disable-multilib
make
make install

The --prefix option installs everything out of the way in its own little directory; I wasn’t really interested in upgrading to a new version of gcc just to build pdftk. The --disable-multilib option turns off some crap that caused build errors.

Once that’s done, building pdftk is just a matter of pointing the makefile at the new gcc stuff.

cd pdftk
# In Makefile.MacOSX, define TOOLPATH=/usr/local/gcc/4.2.2/bin/
make -f Makefile.MacOSX
make install

So that’s how you roll your own.

Posted on Monday, November 26th, 2007. Tags: , , .

7 Responses to “Pdftk 1.41 for Intel Macs”

Posted by Daniel on Friday, December 7th, 2007 at 5:15 PM.

Hi!
Thanks for making this available. I did miss pdftk a lot…

However, if I try to run it, the following error occurs:

dyld: Library not loaded: /usr/local/gcc/4.2.2/lib/libgcj.8.dylib

Shouldn’t this be working without gcc installed?

Best,
Daniel

Posted by Jim on Saturday, December 8th, 2007 at 9:08 AM.

You’re absolutely right; I did not realize the binary version still relied on gcj. That makes it less than useful! Thanks for bringing this to my attention.

I’m not exactly sure what changes are necessary to build a static version. I will post a corrected version as soon as I figure that out.

Posted by Geir Aalberg on Monday, January 7th, 2008 at 11:40 PM.

The binary installer on the PDFtk homepage includes all the necessary libraries plus the pdftk binary itself.

Posted by Jim on Monday, January 7th, 2008 at 11:56 PM.

Thanks, Geir!

That installer provides pdftk 1.12, which does not include the handy stamp operation introduced in version 1.40. (This was the main reason I wanted to provide an updated binary.)

However, the gcj libraries provided with that installer may indeed satisfy my version’s dependencies. Daniel and others may wish to see if my build works after running that installer. If so, please report here!

Posted by Daniel on Wednesday, January 9th, 2008 at 3:11 AM.

Pdftk 1.12 includes libgcj.5. Unfortunately, creating a symlink to it does not work.

Best,
Daniel

Posted by Fran├žois on Friday, March 5th, 2010 at 1:51 AM.

How very odd…

‘pdftk –version’ on the command line works fine,
but executing the ruby script pdftk --version yields
“dyld: Library not loaded: /usr/local/gcc/4.2.2/lib/libgcj.8.dylib”

Posted by Mark on Monday, August 2nd, 2010 at 10:17 AM.

Here you can find a binary version of 1.41 including the necessary libraries:

http://fredericiana.com/2010/03/01/pdftk-1-41-for-mac-os-x-10-6/