“Just enough TeX”

MiKTeX supports the notion of a scalable TeX system: users install just the TeX packages they need for their authoring tasks.

Step 1: bare TeX installation

Fresh MiKTeX installations on Linux and macOS start with just the executables and some support files. This is called a bare TeX installation.

Step 2: enable automatic package installation

MiKTeX has the ability to install missing files on-the-fly. You can configure this feature in MiKTeX Console, or in a terminal window:

initexmf --set-config-value=[MPM]AutoInstall=yes

If you want to turn it on for all users:

sudo initexmf --admin --set-config-value=[MPM]AutoInstall=yes

Step 3: enjoy your minimal TeX system

From now on, whenever a package is required which hasn't been installed yet, the package installer comes into play.

For example, if you run a TeX engine (pdflatex, xelatex, lualatex) the first time, you will see something like this:

...
======================================================================
starting package maintenance...
installation directory: ~/miktex/texmfs/user/install
package repository: https://ctanmirror/ctan/systems/win32/miktex/tm/packages/next/
visiting repository https://ctanmirror/systems/win32/miktex/tm/packages/next/...
repository type: remote package repository
loading lightweight database...
downloading https://ctanmirror/systems/win32/miktex/tm/packages/next/miktex-zzdb1-2.9.tar.lzma...
173544 bytes, 459.29 KB/Sec
lightweight database digest: a59926f76b83fcc2ac8f84b6d3d792de
going to download 9376605 bytes
going to install 209 file(s) (1 package(s))
downloading https://ctanmirror/systems/win32/miktex/tm/packages/next/ltxbase.tar.lzma...
9376605 bytes, 4152.76 KB/Sec
extracting files from ltxbase.tar.lzma...
======================================================================
...

Here the LaTeX base package (ltxbase) is downloaded and installed while you process a LaTeX document.