0

I have installed texlive 2015 on my computer, but When I test it in the terminal there is nothing happened, like this:

meng@meng-Inspiron-5548:~$ tex

meng@meng-Inspiron-5548:~$ 

But if I use sudo tex, the result would be like this:

meng@meng-Inspiron-5548:~$ sudo tex

[sudo] password for meng: 

This is TeX, Version 3.1415926 (TeX Live 2013/Debian)

**

I tried to find the directory for these two versions:

meng@meng-Inspiron-5548:~$ which tex

/usr/local/texlive/2015/bin/x86_64-linux/tex

meng@meng-Inspiron-5548:~$ sudo which tex

[sudo] password for meng: 

/usr/bin/tex

It seems the system is using 2013 automatically but I have added the 2015's PATH to profile and bashrc, so how can I use 2015?

Mensch
  • 65,388
  • I have PATH=/usr/local/texlive/2015/bin/x86_64-linux:$PATH; export PATH MANPATH=/usr/local/texlive/2015/texmf-dist/doc/man:$MANPATH; export MANPATH INFOPATH=/usr/local/texlive/2015/texmf-dist/doc/info:$INFOPATH; export INFOPATH in my bashrc. – Sigur Sep 05 '15 at 21:55
  • When you use sudo, your PATH is overridden by the superuser's one. – egreg Sep 05 '15 at 23:19
  • @Sigur Bet you don't need to export MANPATH and bet it is recommended that you not do this. (Current best practice says do not do this: the system is better at auto-configuring it. Unless your distro disregards the guidance, in which case, you might not have much choice.) – cfr Sep 05 '15 at 23:34
  • @egreg, this is why I also write the code in /root/bashrc. – Sigur Sep 06 '15 at 16:45

1 Answers1

9

Don't run sudo tex.

At least, not unless you really know why you are doing it, understand the risks and accept the consequences.


OK. That said, there are multiple issues here.

  1. You have multiple TeX installations. This is generally not recommended and you should probably remove Debian's using apt. You will probably need to convince apt that dependencies on TeX are satisfied. Make sure you follow the instructions for installing a fake package in this question.

  2. Setting PATH in ~/.bashrc will not set it system-wide. It sets it for you. It does not, for example, set it for root. Depending on how sudo is configured, some or all of your personal environment settings are likely to be removed when you execute commands using sudo. This is a security feature. On your system, PATH is reset when you use sudo.

That is:

$ echo $PATH

and

$ sudo echo PATH

will return different results. Your PATH includes the binaries in /usr/local/texlive/2015/bin/x86_64-linux/. Moreover, these take priority over those in /usr/bin/. When the PATH is reset, this is no longer the case.

But this doesn't matter because you have no need to run any binaries from /usr/local/texlive/2015/bin/x86_64-linux/ with root privileges in most cases. The exception to this is that you may need to do this if you have installed TeX Live with root privileges. Then you may need to run

/usr/local/texlive/2015/bin/x86_64-linux/tlmgr update --all

giving the full path to tlmgr when you want to update your installation.

If you really want even root to access the new binaries by default, then you can. But you should certainly not do this while Debian's texlive packages are still installed on your system and, as I say, there is no need to do this in general. I configure the PATH for TeX Live's binaries for all users explicitly excepting the root user for security reasons.

cfr
  • 198,882
  • 1
    @AdaSunderland You're welcome. If this answers your question, please consider accepting it by clicking the greyed-out checkmark at the top left (where the up/down buttons are). This is the local equivalent of saying 'thanks'. (Though people say 'thanks', too, as checkmarks are a bit impersonal sometimes ;).) – cfr Sep 06 '15 at 02:35