Tx · LaTeX & TikZ

How to Install pdflatex on Windows, macOS, or Linux

Published By the 9to5Science editorial team

At a glance

  1. 1. Choose a distribution

    Install MiKTeX or TeX Live on Windows, MacTeX on macOS, or your Linux distribution’s TeX packages.

  2. 2. Install and update

    Use the distribution’s installer or package manager, and allow it to install the LaTeX base components.

  3. 3. Check the command

    Open a new terminal and run pdflatex --version to confirm the executable is available.

  4. 4. Compile a test file

    Save a minimal LaTeX document as test.tex and run pdflatex test.tex in its folder.

The pdflatex command is the LaTeX engine that turns a .tex source file into a PDF. It is normally installed as part of a TeX distribution, rather than as a standalone program. The right installation depends on your operating system; after installing, you can check that your terminal can find the command and compile a test document.

Choose a TeX distribution

Pick one distribution that suits your system. Installing multiple distributions is possible, but can make it unclear which pdflatex your editor or terminal is using.

Operating systemCommon choiceOther option
WindowsMiKTeXTeX Live
macOSMacTeXBasicTeX, a smaller TeX Live-based option
LinuxTeX packages from your distributionTeX Live’s installer

Download installers from the project’s official site or use your operating system’s package manager. Avoid downloading a pdflatex executable from an unrelated website.

Install on Windows

Download and run the installer for either MiKTeX or TeX Live. Follow its prompts and install the LaTeX components. MiKTeX can offer to install missing packages when you compile; TeX Live’s installation choices range from a small selection to a larger collection.

When setup finishes, open a new Command Prompt or PowerShell window and run:

pdflatex --version

If Windows reports that the command is not recognized, check whether the distribution’s bin directory is on your PATH. The installer may set this up for you; if you changed the path manually, start a new terminal afterward. To see which executable Windows finds, use:

where.exe pdflatex

If more than one result appears, you may have multiple TeX installations. Make sure the one you intend to use comes first on PATH.

Install on macOS

Install MacTeX, which provides TeX Live and supporting tools. If you need a smaller installation, BasicTeX is a more compact option, but you may need to add packages as your documents require them.

Open a new Terminal window and run pdflatex --version. If the shell cannot find the command, check that the TeX distribution’s binary directory is included in PATH. You can inspect the result with which pdflatex. If you use a graphical LaTeX editor, restart it after installation so it can pick up the updated environment.

Install on Linux

The simplest route is usually your distribution’s package manager. For example, on Debian or Ubuntu, install the LaTeX base package with:

sudo apt update
sudo apt install texlive-latex-base

That package provides the basic LaTeX tools, including pdflatex. Other Linux distributions use different package names and package managers; search their documentation for the TeX Live LaTeX base packages. For a fuller or more consistent TeX Live installation across systems, you can instead use the TeX Live installer.

After installation, open a terminal and check pdflatex --version. On Linux, which pdflatex shows the executable your shell will use.

Test the installation

Create a file named test.tex containing this minimal document:

\documentclass{article}
\begin{document}
Hello, PDF!
\end{document}

In a terminal, change to the folder containing the file and run:

pdflatex test.tex

A successful run creates test.pdf in that folder, along with auxiliary files such as test.aux and test.log. Open the PDF to confirm the output. The same command works in Command Prompt or PowerShell on Windows.

If the command still does not work

First distinguish an installation problem from a document or package problem. If pdflatex --version fails, the command is missing from the terminal’s PATH, or the distribution was not installed correctly. If the version command works but compiling reports a missing package, install that package through MiKTeX Console or TeX Live’s package manager, as appropriate.

If a graphical editor says it cannot start pdflatex but the terminal command works, check the editor’s compiler setting and restart the editor. It may be configured to use an old or incorrect executable path. Also avoid mixing package-management methods within one TeX installation; use the manager supplied for that distribution.

Common mistakes

  • Installing an editor but not a distribution: Editors such as TeXstudio provide a writing interface; they do not necessarily include pdflatex.
  • Trying to install only the engine: Install a TeX distribution that includes the LaTeX formats and supporting files.
  • Checking in an old terminal: A terminal opened before installation may not see newly added path settings. Open a fresh one and test again.
  • Assuming a missing package means pdflatex is absent: If the version check succeeds, the engine is installed; the document may need an additional package.
  • Using the wrong installation: If several TeX distributions are installed, check the path reported by where pdflatex or which pdflatex and configure your editor to use the intended one.

References

  1. MiKTeX: Download
  2. TeX Live: Acquiring TeX Live
  3. MacTeX

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.