How do I completely remove (all versions of) pdftk

2019-02-27 19:20发布

问题:

I am having trouble with pdftk on my Mac OS X 10.11 and want to remove all traces of it from my system before attempting to make a new install with the newest package 2.02 (available here on StackOverflow) which I already installed.

I suspect there might be more than one version in my system.

When I try

pdftk --version

the system gives an error:

dyld: Symbol not found: __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
Referenced from: /usr/local/bin/pdftk
Expected in: /usr/local/bin/../lib/libstdc++.6.dylib
in /usr/local/bin/pdftk
Trace/BPT trap: 5

and when I run

export DYLD_LIBRARY_PATH=/opt/pdflabs/pdftk/lib:$DYLD_LIBRARY_PATH

and check for the version I get

pdftk 2.02 a Handy Tool for Manipulating PDF Documents
Copyright (c) 2003-13 Steward and Lee, LLC - Please Visit: www.pdftk.com
This is free software; see the source code for copying conditions. There is
NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

How do I remove them from the system?

EDIT: I actually tried the "version" option on both places, by going to each folder and typing

pdftk --version

I got the problem on the /usr/local folder, but the /opt folder printed the version. It seems I really do have two versions of pdftk on my computer and the default is the problematic one.

回答1:

I do not know how to uninstall the default pdftk, but the pdftk binary in /opt/pdflabs/pdftk/bin/pdftk seems to use by default the correct libraries. So in the meantime you could just change your PATH (in .bashrc / .bash_profile) so that the pdftk you use by default if the good one with something like

export PATH=/opt/pdflabs/pdftk/bin:$PATH

In the /opt/pdflabs/pdftk/bin there is also a pdftk_uninstall.sh that will uninstall the /opt/pdflabs when necessary. I guess that will be when pdflabs releases an official updated pdftk that installs the good version in the default directories.