How to print the list of packages installed on TeX Live to a file?

Simply type the following command in a terminal / command prompt:

tlmgr list --only-installed > installed_texlive_packages.txt

which will save the list to a file called installed_texlive_packages.txt.


Compile it with -shell-escape option.

enter image description here

enter image description here

\documentclass[10pt]{article}
\usepackage[a6paper,hmargin=3mm,vmargin=12mm]{geometry}

\usepackage[T1]{fontenc}
\begingroup
\catcode`\^^M=12\relax%
\expandafter\gdef\expandafter\trimtok\detokenize{i}#1^^M{#1}%
\gdef\trimmer#1{\expandafter\trimtok #1}%
\endgroup

\newread\reader

\immediate\write18{tlmgr list --only-installed > installed-packages.txt}
\begin{document}
\tiny
\begin{enumerate}
\openin\reader=installed-packages.txt\relax
\loop
    \readline\reader to \data
    \unless\ifeof\reader
        \item \trimmer{\data}
\repeat
\closein\reader
\end{enumerate}
\end{document}

For animated version, click this link (only several KiB).


In 2020, type :

tlmgr info --only-installed

to get the list of installed package. Then do whatever you want with the output (like putting it in a file with > myfile.tx).

info command replaces former show and list commands (tlmgr manual: "The former actions "show" and "list" are merged into this action, but are still supported for backward compatibility".)