Setting the PATH for TeX Live

Upstream prefers to install in /usr/local but the BLFS editors regard that as inconvenient, and think using /opt/texlive is more appropriate. Originally BLFS used a full binary install to bootstrap the source install, so the same prefix is used for both.

Before starting to build TeX Live, set up your PATH so that the system can properly find the files. If you set up your login scripts as recommended in The Bash Shell Startup Files, update the needed paths by creating the texlive.sh script. The programs are always installed in an <ARCH>-linux subdirectory and on 32-bit x86 this is always i386-linux. For x86_64 and i?86 we can generate this as $TEXARCH:

[Note]

Note

If upgrading from a previous year's version, you should manually edit texlive.sh to ensure that the version for the year you wish to use is the only TeX present (some people need to keep multiple years available to ensure there are no regressions in their documents).

Now, create the texlive.sh script as the root user:

TEXARCH=$(uname -m | sed -e 's/i.86/i386/' -e 's/$/-linux/')

cat > /etc/profile.d/texlive.sh << EOF
# Begin texlive setup
TEXLIVE_PREFIX=/opt/texlive/2024
export TEXLIVE_PREFIX

pathappend \$TEXLIVE_PREFIX/texmf-dist/doc/man  MANPATH
pathappend \$TEXLIVE_PREFIX/texmf-dist/doc/info INFOPATH
pathappend \$TEXLIVE_PREFIX/bin/$TEXARCH

TEXMFCNF=\$TEXLIVE_PREFIX/texmf-dist/web2c
export TEXMFCNF

# End texlive setup
EOF

unset TEXARCH
[Note]

Note

The standard MANPATH and INFOPATH path are specified above to ensure they are included. If they are already set in the boot script procedure, the pathappend function will ensure duplicates are removed, so including them here will do no harm.

[Note]

Note

The backslashes before the dollar signs in the script above are to facilitate a copy/paste operation. The backslashes should not appear in the actual script.

The new paths can be immediately activated by running:

source /etc/profile

You should now proceed either to install-tl-unx for a binary installation of texlive, or to texlive-20240312 to begin installing from source.