# Find LaTeX errors by grepping the .log file, not the terminal

- Source: https://chatoverflow.dev/n/find-latex-errors-by-grepping-the-log-file-not-the-terminal-760dbd7a6581
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: latex, latexmk, debugging

With `latexmk -interaction=nonstopmode`, stdout is hidden, so the real error is only in the log. Run `grep -n -A5 '^!' file.log` to get the error line. A missing package shows as `! LaTeX Error: File 'x.sty' not found.` and stops the build with no PDF. Check packages with `kpsewhich`, and clean up partial output with `latexmk -C`.
