How do I completely remove (all versions of) pdftk server from Mac OS X?
Asked Answered
B

2

6

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.

Baskin answered 15/12, 2015 at 12:23 Comment(0)
L
2

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.

Latif answered 22/12, 2015 at 11:40 Comment(6)
Basilio, looking at the pdftk_uninstall.sh file, it seems it is set to also remove /usr/share/man/man1/pdftk.1 and /usr/local/bin/pdftk. I ran the uninstall (with sudo) and it removed the binaries, but when I reinstalled the new package, I still got the same error. The problem is that the package is not setting the path of the libraries to the new installed set (in /opt). I have the export you stated above in my .bashrc, but it seems when I log in the PATH is not set.Baskin
Your are right, I had not checked carefully the pdftk_uninstall.sh In my system just adding the new path works fine for me. I work with the new pdftk from /opt/pdflabs/pdftk/bin just fine. Did you try doing the same also in .bash_profile? Sometimes bash uses .bashrc, other time .bash_prifleLatif
I tried it, but didn't work (even after restarting system twice). What I noticed is that when I ran the uninstall, the /usr/local binary was removed, but when reinstalled, it was back. So I figured that the newest package is installing a (default) copy of pdftk in /usr/local, but looks for the (old) libraries in ../lib/. I then moved ALL libraries to a temp folder. When I typed pdftk --version in the Terminal, it worked. I don't think I need any of the (old) libraries in that folder (but I will keep a safe backup of them just in case). Thanks for the help.Baskin
Even though your answer didn't actually work for me, it helped me find a solution. So I will accept it.Baskin
Thank you. Very interesting. I also learned from your explanation. I cannot get rid of those libraries because I need them for other things, so good for me my solution works at least for me (I had the same very problem) :) Cheers.Latif
I'm having the same problem. The /usr/local/bin version is just a symlink: /usr/local/bin/pdftk -> /opt/pdflabs/pdftk/bin/pdftk and it appears to find an older version of the libc++ library running from the (default) path. Running the /opt/pdflabs... version directly avoids the linker error, or you can do sudo cp /opt/pdflabs/pdftk/lib/libstdc++.6.dylib /usr/local/lib/ to replace the older library.Blotchy
A
3

I found pdftk_uninstall.sh script on /opt/pdflabs/pdftk/bin/ directory.

I copy-past script with -f flag for rm command

rm -f /usr/share/man/man1/pdftk.1;rm -f "/opt/pdflabs/pdftk/man/pdftk"*;rm -f /usr/local/bin/pdftk;rm -f "/opt/pdflabs/pdftk/bin/pdftk"*;rm -f "/opt/pdflabs/pdftk/license_gpl_pdftk/reference/"*;rmdir "/opt/pdflabs/pdftk/license_gpl_pdftk/reference";rm -f "/opt/pdflabs/pdftk/license_gpl_pdftk/third_party/"*;rmdir "/opt/pdflabs/pdftk/license_gpl_pdftk/third_party";rm -f "/opt/pdflabs/pdftk/license_gpl_pdftk/"*;rmdir "/opt/pdflabs/pdftk/license_gpl_pdftk";rm -f "/opt/pdflabs/pdftk/changelog.html" "/opt/pdflabs/pdftk/changelog.txt"

This help for me 🎉

Ageratum answered 21/2, 2022 at 8:40 Comment(0)
L
2

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.

Latif answered 22/12, 2015 at 11:40 Comment(6)
Basilio, looking at the pdftk_uninstall.sh file, it seems it is set to also remove /usr/share/man/man1/pdftk.1 and /usr/local/bin/pdftk. I ran the uninstall (with sudo) and it removed the binaries, but when I reinstalled the new package, I still got the same error. The problem is that the package is not setting the path of the libraries to the new installed set (in /opt). I have the export you stated above in my .bashrc, but it seems when I log in the PATH is not set.Baskin
Your are right, I had not checked carefully the pdftk_uninstall.sh In my system just adding the new path works fine for me. I work with the new pdftk from /opt/pdflabs/pdftk/bin just fine. Did you try doing the same also in .bash_profile? Sometimes bash uses .bashrc, other time .bash_prifleLatif
I tried it, but didn't work (even after restarting system twice). What I noticed is that when I ran the uninstall, the /usr/local binary was removed, but when reinstalled, it was back. So I figured that the newest package is installing a (default) copy of pdftk in /usr/local, but looks for the (old) libraries in ../lib/. I then moved ALL libraries to a temp folder. When I typed pdftk --version in the Terminal, it worked. I don't think I need any of the (old) libraries in that folder (but I will keep a safe backup of them just in case). Thanks for the help.Baskin
Even though your answer didn't actually work for me, it helped me find a solution. So I will accept it.Baskin
Thank you. Very interesting. I also learned from your explanation. I cannot get rid of those libraries because I need them for other things, so good for me my solution works at least for me (I had the same very problem) :) Cheers.Latif
I'm having the same problem. The /usr/local/bin version is just a symlink: /usr/local/bin/pdftk -> /opt/pdflabs/pdftk/bin/pdftk and it appears to find an older version of the libc++ library running from the (default) path. Running the /opt/pdflabs... version directly avoids the linker error, or you can do sudo cp /opt/pdflabs/pdftk/lib/libstdc++.6.dylib /usr/local/lib/ to replace the older library.Blotchy

© 2022 - 2024 — McMap. All rights reserved.