# What is causing this AUCTeX preview fatal error, or how can I find that out?

This is a minimal test file:

\documentclass{article}
\begin{document}
$1+1=2$
\end{document}


The content of texput.log is the following:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex 2019.10.7)  23 OCT 2019 23:49
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi} \input {\detokenize{ _region_.tex }}^^M

! Emergency stop.

<*> ...5]\fi} \input {\detokenize{ _region_.tex }}
^^M
*** (cannot \read from terminal in nonstop modes)

Here is how much of TeX's memory you used:
8 strings out of 492166
160 string characters out of 6125377
59039 words of memory out of 5000000
4473 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
5i,0n,6p,268b,10s stack positions out of 5000i,500n,10000p,200000b,80000s
!  ==> Fatal error occurred, no output PDF file produced!


The problem appeared after one time I ran brew upgrade in terminal. I guess it is because the latest ghostscript has some incompatibility issue with AUCTeX. I have searched a lot and tried a lot. Here are what I have done:

1. I use Mac. There is a known problem with the path of ghostscript. This line is in my init file: (setq preview-gs-command "/usr/local/bin/gs"). It should be correct.
2. I have tried to manually install old versions of ghostscript, like 9.21 or 9.25. They used to solve the problem, but not this time.
3. I uninstalled ghostscript installed with brew and manually installed 9.25. Not working.

System: MacOS Catalina 10.15
Emacs: GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02
AUCTeX: 12.1.2
ghostscript: 9.25

• I noted that the format loading message is missing in the output and the %&-line parsing enabled-thing. Looks like -parse-first-line is enabled but the actual magic comment is missing in the LaTeX file. – Tobias Oct 25 '19 at 12:38