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 26, 2007 at 8:46 PM
5 Comment
Posted by Daniel on 7/12/07 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,
DanielPosted by Jim on 8/12/07 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 on 7/1/08 11:40 PM:
The binary installer on the PDFtk homepage includes all the necessary libraries plus the pdftk binary itself.
Posted by Jim on 7/1/08 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 9/1/08 3:11 AM:
Pdftk 1.12 includes libgcj.5. Unfortunately, creating a symlink to it does not work.
Best,
Daniel

