The TeXLive installer gives users on Unix-like systems (I use Debian Stable) the option to install symbolic links in the /usr/local/bin directly for the TeX executables (tex, pdflatex, pdfcrop, cweave, and many others).

Doing so has the positive effect that the user does not need to change any environmental variables to run TeX, since, /usr/local/bin is already in the system's search path. The disadvantage is that this requires one to install as root, which can create security problems and makes it harder to adjust the distribution; and it puts files in an important system directory rather than keeping the distribution contained inside /usr/local/texlive.

When I install the new year's distribution, I do not want to use the symbolic links again; it seems simpler now to add the path manually.

How, then, can I remove the symbolic links from the previous year's installation that are still in /usr/local/bin? Can I do this through last year's installer, perhaps?

(I would also appreciate comments regarding the benefits or problems of using the symbolic links, though I know that is opinion-based. Also, I realize the technical content of the question might be better suited to the Unix-Linux Stackexchange, but it seemed to me this was a question that should be on this site as many TeX users are likely to encounter it.)

  • (cd /usr/local/bin; ls -l) | grep '^l.*/usr/local/texlive/bin/' | sed 's/^.*2014 \([a-zA-Z0-9\-\_]*\) \->.*$/\1/' should give you a list. – cfr Jul 25 '15 at 20:48
  • @cfr Thank you for this! I need to learn regular expressions! My links point to /usr/local/texlive/2014/bin/ and this didn't catch all the filenames with special characters, so I had to fiddle with it a bit. This worked to make a list of file names: (cd /usr/local/bin; ls -l) | grep '^l.*/usr/local/texlive/2014/bin/' | sed 's/^.* \([a-zA-Z0-9\+\.\_\CHAR-]*\) \->.*$/\1/' > /tmp/texlinks.txt – musarithmia Jul 25 '15 at 21:28
  • Yes. Sorry. I didn't have a list to compare. I should have said 'should give you most of a list' ;). – cfr Jul 25 '15 at 21:30
  • 1
    @egreg Isn't /etc/paths.d a Mac OS X thing? Certainly it is not generally available on GNU/Linux systems. (I don't have it and that is not how I add to PATH on my machines.) – cfr Jul 25 '15 at 22:21
  • 1
    @AndrewCashner Although I agree with egreg and wouldn't add symbolic links in /usr/local/bin, it is important that this directory is not intended to be used for system files in the sense that it is not managed by your distro's package manager. You should be able to delete everything in /usr/local without upsetting apt, for example. So this is very different from, say, installing links into /usr/bin which would be poking things into areas which your package manager expects to manage itself. (Sometimes, there are still reasons to do it, but not lightly.) – cfr Jul 25 '15 at 22:24

Updated for TL2017, in case you go through the grep command too quickly (not that this happened to me).

Thanks to @cfr for showing me how to use grep to select the symbolic link files and then use sed to extract the filenames from the directory listing.

In a terminal running a Bash shell, the following command extracts a list of filenames from /usr/local/bin which are symbolic links to the bin folder within last year's TeXLive distribution, and saves the list in a temporary file. Check this file before going on to the next step.

(cd /usr/local/bin; ls -l) | grep '^l.*/usr/local/texlive/2017/bin/' | sed 's/^.* \([a-zA-Z0-9\+\.\_\CHAR-]*\) \->.*$/\1/' > /tmp/texlinks.txt

This command iterates through the list and permanently removes the files, checking for permission before each one:

sudo xargs -rd '\n' --arg-file=/tmp/texlinks.txt rm -i --

Now you will also need to delete the man pages and info pages. These are located in /usr/local/man and /usr/local/info. In my particular case, the entire contents of these folders were symbolic links to files from the old TeXLive distribution, so I could just do the following. Be warned: Check the contents of these directories first! (ls -l)

sudo rm -ri /usr/local/man/*
sudo rm -ri /usr/local/info/*

After logging out and back in again, all traces of the old distribution are gone.

Anyone who follows these instructions does so at their own risk. Your own setup will probably vary from mine, so be careful.

And next time, don't create the symbolic links when you install!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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