Tx · LaTeX & TikZ

Fix “Could Not Start the Command: pdflatex” in a LaTeX Editor

Published By the 9to5Science editorial team

At a glance

  1. 1. Test pdflatex

    Run pdflatex --version in a terminal to check whether the executable is installed and discoverable.

  2. 2. Check the editor command

    Confirm the editor points to the right pdflatex executable and uses its own filename placeholder correctly.

  3. 3. Fix the executable path

    Add the TeX distribution’s binary folder to PATH, or configure the editor with the full executable path.

  4. 4. Restart and retry

    Restart the editor after changing PATH, then compile a simple .tex file and inspect any new log errors.

If your editor reports “Could not start the command” for pdflatex -synctex=1 -interaction=nonstopmode %.tex, it usually cannot find or launch the pdflatex executable. That is different from a LaTeX compilation error: TeX has generally not started processing your document yet.

The fix is usually to install a TeX distribution, make its executable available to the editor, or correct the editor’s command setting. The exact menus vary by editor and operating system, but the checks below apply broadly.

1. Check whether pdflatex runs outside the editor

Open a terminal or command prompt and run:

pdflatex --version

If the command prints version information, pdflatex is installed and your terminal can find it. If you get a message such as “not recognized” on Windows or “command not found” on macOS or Linux, either the program is not installed or its directory is not on the terminal’s PATH.

On Windows, you can check where the command is found with:

where pdflatex

On macOS or Linux, use:

which pdflatex

If no location is returned, install a TeX distribution such as MiKTeX or TeX Live, or update PATH to include the distribution’s binary directory. With MiKTeX, the folder often resembles C:/Program Files/MiKTeX/miktex/bin/x64, but the actual location depends on the installation and whether it is a per-user or system-wide install.

2. Check the editor’s command setting

Find the editor’s configuration for the pdfLaTeX command. Confirm that it names pdflatex and includes the options in the editor’s expected format. The command shown in the error may be a normal editor configuration, where %.tex is a placeholder that the editor replaces with the current document’s filename.

Do not assume that %.tex is a literal filename to type into a terminal. The placeholder syntax belongs to the editor, and different editors can use different placeholders. If you enter an editor-specific command in a terminal, it may fail even though the editor would substitute the placeholder correctly.

If the editor cannot find pdflatex by name, set its command to the full path to the executable. For example, if your installation really contains the executable at that location, a Windows command could look like this:

"C:/Program Files/MiKTeX/miktex/bin/x64/pdflatex.exe" -synctex=1 -interaction=nonstopmode %.tex

Use the path that exists on your computer, and keep the editor’s own filename placeholder unchanged. Quote the executable path if it contains spaces; do not put quotation marks around the entire command line.

3. Make the TeX executable visible to the editor

An editor launched from a desktop icon may have a different environment from a terminal you opened later. This can happen if you changed PATH after starting the editor, or if the editor was already running during installation.

After changing PATH or installing MiKTeX, close and reopen the editor. If the editor still cannot launch pdfLaTeX, use its full executable path setting as described above. Also check whether you have more than one TeX distribution installed: the editor may be pointing to an old or removed installation while the terminal finds a different one.

A useful concrete check is to compare the output of where pdflatex (or which pdflatex) with the executable path configured in the editor. They should identify the same working installation, unless you deliberately choose a different one.

4. Test with a small document

Save this file as test.tex and compile it through the editor:

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

If the editor now starts the command but reports errors, check the generated log: that means the launch problem is solved and the remaining issue is in the document or TeX setup. If it still reports that it cannot start the command, recheck the executable path, the editor’s command syntax, and whether the file path or command contains incorrectly quoted arguments.

Common mistakes

  • Treating this as a document syntax error. Errors such as “Missing $ inserted” appear after TeX starts. A launch failure usually occurs before a useful .log file is produced.
  • Using the wrong executable path. MiKTeX locations differ across versions, architectures, and install types. Verify the path rather than copying one from an example.
  • Using the placeholder in a terminal. %.tex is commonly an editor substitution, not a shell wildcard or real filename.
  • Forgetting to restart the editor. A running application may not see a newly changed PATH.
  • Reinstalling before checking configuration. If pdflatex --version works, first correct the editor’s command or executable location; reinstalling is usually unnecessary.

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