Gorticus' brain

Brain and brain. What is brain?!?

Uninstalling MacTeX 2011

| Comments

Before starting, read the disclaimer below.

Long live $\TeX$!

If you are a Mac and $\TeX$ user, you are likely a MacTeX user. If you’ve been using it for a while, you have probably accumulated a fair number of versions, since it is on a roughly yearly release cycle. To remove the cruft before installing a new release, I’ve taken to removing the old installation. If you’ve tried this, you may have looked at the uninstall instructions, e.g. for 2011, and found them to be, well, somewhat lacking, e.g. stackexchange. The last part, where the instructions suggest using Show Files from the installer, not particularly useful, given the number of files involved, and the fact there didn’t seem to be a way (on 10.7.4) to export the file list.

What’s installed

Like the uninstall procedure expects, you’ll need access to the 2011 MacTeX.mpkg.zip file. Make a directory and unzip the file

Decompress the old installer package
1
2
3
$ mkdir cleanup
$ cd cleanup
$ unzip /path/to/MacTeX.mpkg.zip

which could create a MacTeX.mpkg directory in your pwd. Now you can build a table of contents from the archives included, assuming bash

Generate TOC
1
2
3
for a in $(find MacTeX.mpkg -name Archive.pax.gz); do
  pax -zvf $a | awk '{print $9}' | sed -e 's/^.//'
done > mactex.toc

Relax, it may take some time, on the order of a minute or two.

Dirs and files

From the toc, the files and dirs can be separated. We know two directories whose individual files and sub-directories will be removed wholesale

Complete directory trees to be removed
1
2
/Applications/TeX
/usr/local/texlive/2011

These trees are filtered from the toc to reduce the noise in the output. A small script will test if a line is a directory (-d) or a regular file (-f)

getem.sh: Filter toc for remaining files or dirs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

I='mactex-2011-toc.txt'
P=( \
  "^\/usr\/local\/texlive\/2011\/.+$" \
  "^\/Applications\/TeX\/.+$" \
)

case "$1" in
  -d) O='mdirs.txt';;
  -f) O='mfiles.txt';;
   *) echo "usage: getem.sh [-d|-f]"; exit 1;;
esac

for l in $(sed -E -e "/${P[0]}|${P[1]}/d" < $I); do
  test "$1" "$l" && echo "$l"
done | sort -u > $O

The P var holds the sed patterns to filter everything below the tree heads identified above. For my install, the directories output were

Example directories culled
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/Applications
/Applications/TeX
/Library
/Library/Fonts
/usr
/usr/local
/usr/local/bin
/usr/local/lib
/usr/local/lib/ImageMagick-6.6.9
/usr/local/lib/ImageMagick-6.6.9/modules-Q16
/usr/local/lib/ImageMagick-6.6.9/modules-Q16/coders
/usr/local/lib/ImageMagick-6.6.9/modules-Q16/filters
/usr/local/share
/usr/local/share/ghostscript
/usr/local/share/ghostscript/9.02
/usr/local/share/ghostscript/9.02/doc
/usr/local/share/ghostscript/9.02/examples
/usr/local/share/ghostscript/9.02/examples/cjk
/usr/local/share/ghostscript/9.02/lib
/usr/local/share/man
/usr/local/share/man/de
/usr/local/share/man/de/man1
/usr/local/share/man/man1
/usr/local/texlive
/usr/local/texlive/2011

Clearly, there are some directories that should not be removed! My revised dir list was

mdirs-short.txt: Realistic dirs to remove
1
2
3
4
/Applications/TeX
/usr/local/texlive/2011
/usr/local/lib/ImageMagick-6.6.9
/usr/local/share/ghostscript

So, in addition to the two trees we already expected to prune, the additional installed ImageMagick and ghostscript dirs will be removed. These were removed by invoking

Remove the realistic dirs
1
$ cat mdirs-short.txt | xargs sudo rm -rf

where sudo is necessary, as it was installed as root. On to the files, like removing the dirs, invoke

Removing remaining files
1
$ cat mfiles.txt | xargs sudo rm -f

Once complete, you should feel about 1.7 GB lighter for the full install.

The preference pane

To remove the old preference pane from System Preferences

Remove the preference pane
1
$ sudo rm -rf /Library/PreferencePanes/TeXDistPrefPane.prefPane

Comments

If you instead installed the smaller package, or also added the extras, use the same process once you obtain a toc from the files.

Now the upgrade

Out with the old and in with the new. The old cruft is gone and you can install the new release. Happy $\TeX$-ing.

Disclaimer

This is the process I used to clean-up Mac$\TeX$ 2011. Use it at your own risk. This procedure is provided AS-IS and without warranty of any kind. In no event will I be liable for any damages arising out of the use or inability to use this process. For example, if it causes wild flying monkeys to burst from your bum, proceed to rend your citadel down around your ears, put your old floppy disk into your toaster and use it to set fire to the detritus of your keep and salt the very earth, all while you watch from the last remaining parapet: your problem, not mine.

Comments