TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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. – Jan Hlavacek Nov 20 '10 at 19:48
up vote 1 down vote accepted

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

share|improve this answer
But how do I know what all the associated files are? – Jan Hlavacek Nov 20 '10 at 19:04
See Andrew's answer below. – Thorsten Donig Nov 20 '10 at 19:11
Now I see why I try to avoid using above and below ... – Hendrik Vogt Nov 21 '10 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. – Hendrik Vogt Nov 21 '10 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! – Hendrik Vogt Mar 17 '11 at 14:38

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

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

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:


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

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.

share|improve this answer
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`. – Jan Hlavacek Nov 20 '10 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. – Loop Space Nov 20 '10 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. – Jan Hlavacek Nov 21 '10 at 0:25

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:


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.

share|improve this answer

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!

share|improve this answer
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. – Jan Hlavacek Nov 21 '10 at 0:29

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.

share|improve this answer
That's a great way to keep things organised! – Will Robertson Nov 21 '10 at 13:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.