5

I have a locally installed pgf in my local texmf tree. Now my tex distribution finally caught up and the version of pfg in the package manager is newer than my locally installed version. How can I delete the local version?

1
  • 4
    The reason I am asking is that there are number of answers on this site recommending people to install a local copy of pgf in order to get the newest and greatest features. But we never seem to tell anybody that when they do that, they are actually taking over their package managers handling of pgf, and are now responsible for updating pgf themselves. I thought that in addition of having a guide for installing a local copy of pgf, we should also have one on removing it. Commented Nov 20, 2010 at 19:48

5 Answers 5

1

You have to delete all associated files manually and then refresh the filename database (FNDB). The details of this process depend on your OS.

5
  • 1
    But how do I know what all the associated files are? Commented Nov 20, 2010 at 19:04
  • See Andrew's answer below. Commented Nov 20, 2010 at 19:11
  • 1
    Now I see why I try to avoid using above and below ... Commented Nov 21, 2010 at 8:08
  • This is just a wild guess, but it might be that we have some serious misunderstanding here. My above comment was meant on the funny side (forgot to put some :-)). It was not meant as a critique to you answer, nor did I downvote the answer. If you have no idea why I put this new comment here, then maybe my wild guess was incorrect. If you have an idea, then I would be very grateful for a confirmation that my guess was correct. @Anybody else who has no idea what this is about: Sorry; I hope that I'm not abusing the comment function too heavily here. Commented Nov 21, 2010 at 11:55
  • I still have the feeling that I offended you somehow. I'd really like to know, is there anything I can clarify? Thanks! Commented Mar 17, 2011 at 14:38
4

To find out what files, you can get hold of the original archive that you got pgf from and list the files, then you can use that list to delete the right files.

I'm using zsh on a Linux machine, and I downloaded the pgf tree into my Desktop folder, so in my texmf directory, I could do:

for f in $(unzip -ql ~/Desktop/pgf_2.10.tds.zip); do
[[ -e $f && -f $f ]] && rm $f
done

To remove any empty directories, you could then do

for f in $(unzip -ql ~/Desktop/pgf_2.10.tds.zip); do
[[ -e $f && -d $f ]] && rmdir -p $f
done

Note that rmdir only deletes empty directories so it's safe. You have to do this afterwards, and you have to specify the -p (remove parents) because directories tend to be listed first in the archive, so in the archive you might have:

a
a/b
a/b/c.txt

but when deleting them, you need to delete them in reverse order.

(I suppose you could modify the original script to reverse the order:

for f in $(unzip -ql ~/Desktop/pgf_2.10.tds.zip | tac); do
[[ -e $f && -f $f ]] && rm $f
[[ -e $f && -d $f ]] && rmdir $f
done

if you really wanted to)

You could also just move them out of the way, rather than deleting them. And I'd recommend making a backup of your texmf tree before doing this in case you accidentally delete a file that you shouldn't have done.

3
  • On my system, unzip -ql returns some other info for each file, each line looks like ` 7507 2010-10-25 17:00 tex/generic/pgf/utilities/pgfutil-plain.def. That can be easily fixed by filtering the output through cut`. Commented Nov 20, 2010 at 19:40
  • @Jan: I don't know why, but I couldn't get cut to cut anything! That's why I put the -e $f bit in: it tests to see if $f corresponds to something on the filesystem (I guess there's a danger that you have a file called 7507, of course). If you (or anyone else) can figure out the appropriate cut syntax, I'll happily add it in. Commented Nov 20, 2010 at 22:19
  • This works for me: unzip -ql pgf_2.10.tds.zip | cut -b 31-. I don't know if the 31 is the same on all systems and all versions of unzip, though. Commented Nov 21, 2010 at 0:25
4

Thorsten's and Andrew's answers are excellent, and will pertain to any package that you have installed locally which now needs to be removed. However, there may be an easier way. It seems that all files that the pgf package contains, at least in version 2.10, is contained in one of the following directories:

doc/generic/pgf/
scripts/pgf/
source/latex/pgf/
tex/context/third/pgf/
tex/latex/pgf/
tex/plain/pgf/
tex/generic/pgf/

except the README file that is in the root of the archive. As far as I can tell, no other package should put anything in those directories, so removing these 7 directories with their contents and refreshing the filename database should do the job.

2

This looks for all the subdirectories named pgf in the user's texmf directory, then deletes them.

find ${TEXMFHOME} -type d -name pgf | xargs rm -rf  

Use rm -rf with caution, of course!

1
  • 2
    Nice. I would suggest to first try a dry run: find <user's texmf directory> -type d -name pgf | xargs echo, to see what is going to get removed. Commented Nov 21, 2010 at 0:29
2

In miktex I don't install a local pgf in "the" local texmf tree. I put all the pgf-files in a new texmf tree only for pgf (called eg. testpgf) and then "mount" this tree as a new local texmf tree in miktex settings. When I no longer need this pgf, I "unmount" and then delete the complete tree.

1
  • That's a great way to keep things organised! Commented Nov 21, 2010 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .