107

How can I remove everything that is related to TeX Live from my Ubuntu 12.04? I first used the backport packages from ppa:texlive-backports/ppa and later the manual install via install-tl-unx.tar.gz. Somehow, everything screwed up, so I want to remove everything to start from scratch.

I want to get a recent TeX Live with Biber support and extended font support, i.e. support for Source Sans Pro.

What to do?

doncherry
  • 54,637
mcbetz
  • 4,857

6 Answers6

151

Try the following commands, one after another. If you progress, respective folders may already be deleted:

  1. sudo apt-get purge texlive*

  2. sudo rm -rf /usr/local/texlive/* and rm -rf ~/.texlive*

  3. sudo rm -rf /usr/local/share/texmf

  4. sudo rm -rf /var/lib/texmf

  5. sudo rm -rf /etc/texmf

  6. sudo apt-get remove tex-common --purge

  7. rm -rf ~/.texlive

  8. find -L /usr/local/bin/ -lname /usr/local/texlive/*/bin/* | xargs -r rm

    This finds all the files in /usr/local/bin which point to a location within /usr/local/texlive/*/bin/* and removes them; because we’ve already deleted all of /usr/local/texlive, these are dead links. To see which files are being deleted, replace xargs rm with xargs -t rm (or tee off to a log file, or whatever).


Update

In case that - after the last command (8.) - your terminal returns something like this

rm: cannot remove '/usr/local/bin/deweb': Permission denied
rm: cannot remove '/usr/local/bin/dviconcat': Permission denied
rm: cannot remove '/usr/local/bin/pkfix-helper': Permission denied
rm: cannot remove '/usr/local/bin/ulqda': Permission denied
rm: cannot remove '/usr/local/bin/kpsereadlink': Permission denied
rm: cannot remove '/usr/local/bin/bibmradd': Permission denied
...
...
...

if you know what you're doing, you can add sudo between the pipe and xargs rm, so that it becomes

find -L /usr/local/bin/ -lname /usr/local/texlive/*/bin/* | sudo xargs rm

or, to be more careful and also more thorough, follow the steps of this answer, which worked for me.

Update 2

Refer to this answer to solve the issue of rm: missing operand when running (8.)

DSha
  • 33
mcbetz
  • 4,857
  • That is fine. Without that command, an artifact from debian installation is left over. This isn't a problem for 2012 but it cause a headache for me when installing 2013. – dustin Jun 21 '13 at 13:04
  • So, I have just gone through the process, took me about 20+min, just others can do it, when they've got the time to do so. Since I ran sudo apt-get remove texlive-full before some of the commands did nothing, e.g. ls -ltrh >/tmp/rmlist. Hopefully everything ready for fresh install. – quapka Oct 30 '14 at 08:26
  • 7
    This is why I find it hard to like Linux. With Windows, I click one Uninstall button and I'm done. With Linux, it takes half an hour of command line typing :-/ – Nate Nov 23 '14 at 20:16
  • @mcbetz Very useful answer. For total vim illiterates like me it should be noted that: To insert 'rm' command before each line in the file rmcmd you will need to type vim rmcmd and then :%s/^/ rm-rv /. In the answer above : is missing before %s.... It caused me many headaches. – DBS May 01 '15 at 15:44
  • Why is there anything in /usr/local/bin? Certainly apt ought not put stuff there. For sure, the TeX Live installer doesn't put anything there. (That puts everything in /usr/local/texlive/. Some of the others are presumably the distro spraying files. – cfr Jul 16 '15 at 02:39
  • what is the arev file? I don't have that... – tc88 Jan 05 '16 at 15:27
  • Is this still valid for 2016 also? – Léo Léopold Hertz 준영 Jun 07 '17 at 13:34
  • 5
    @Nate Actually, that's exactly why people use Linux and blame Windows for lacking a decent terminal. ;) I do not want to bring up the old Linux-Windows war, but it's the shortcoming of "texlive" installing system, not Linux. – cartoonist Oct 06 '17 at 21:24
  • 10
    @mcbetz @thymaro Thanks for the answer and edit. However, find -L /usr/local/bin/ -lname /usr/local/texlive/*/bin/* | xargs rm yields the following error: rm: missing operand. I am not sure why this is happening? – DavidC. Oct 25 '18 at 16:38
  • @DavidC. I don't really understand any of it from just looking at it. I'm just an ape following recipes I find online. Sorry for being of little help on this one. Have you tried the -t option mentioned above? What does it return? – thymaro Oct 25 '18 at 18:18
  • @DavidC. @thymaro I have the same problem and the -t option doesn't make a difference, the appearance of the xarg syntax has changed. I understand that step 8 is a check so it doesn't seem so serious not to be able to access it. Anyway I leave testimony of it to be able to correct the answer in the future. – Aradnix May 07 '19 at 02:19
  • I've fixed your problems, @DavidC. That was an old version of the bash command, which I've edited. – Kyle Aug 09 '19 at 01:55
  • Possibly also ~/.texmf-var – randompast May 05 '20 at 04:32
  • @Kyle I have the same issue that DavidC had. How can I fix it? I don't see any fix here. – mrghofrani May 18 '20 at 09:23
  • 1
    @eng.mrgh it's a suggested edit you can find here. – Kyle May 19 '20 at 14:17
  • If symlinks were added in /usr/local/bin/ when installing vanilla TeXLive, step 8 can be achieved with tlmgr path remove, likely needing sudo, before uninstalling. This is also done when calling tlmgr remove --all as @mygod suggests in his answer. – Aleksandr Popov Mar 27 '24 at 17:04
33

Martin Betz's answer is great but it is missing one line that caused issue on my machine (Ubuntu 13.04). This was for upgrading from 2012 to 2013.

After 5., run sudo apt-get remove tex-common --purge. If not, you may have the problem I faced here Does TeXLive2013 need any special install instructions?

dustin
  • 18,617
  • 23
  • 99
  • 204
11

I think you should

  1. remove all packages (via ubuntu's package manager and install-tl too)
  2. remove /usr/{,local}/share/texmf*
  3. remove texmf-releated things from /var/ (maybe /var/lib/texmf)
  4. remove /etc/texmf too
  5. your home directory: ~/.texlive

I think it's enough.

uzsolt
  • 1,431
6

If you installed TeX Live using install-tl: sudo tlmgr remove --all.

Mygod
  • 163
6

For Ubuntu 18.04 LTS you can just use

sudo apt autoremove --purge texlive tex-common

This will delete configuration and/or data files of texlive and tex-common (and it's dependencies)

Trect
  • 477
0

I would add to Ubuntu 22.04 LTS:

sudo rm ~/.local/bin/pdftex

sudo rm ~/.TinyTeX/bin/x86_64-linux/tlmgr

sudo rm ~/.local/bin/xetex

sudo rm ~/.local/bin/luatex

Those were needed for me when trying to install TinyTeX from scratch using the R package tinytex.

Fla28
  • 1