[texworks] (Restricted) shell escape failing on macOS 12.2

Stefan Löffler st.loeffler at gmail.com
Wed Apr 13 21:34:57 CEST 2022

Dear Joseph,

On 13.04.22 00:43, Joseph Wright wrote:
> Hello all,
> With macOS 12.2, I'm getting failures with (close to) dev. TeXworks 
> when I try anything using shell escape/piped input. For example, with 
> input
> [...]
> I get error
> !!! Error: Cannot open Ghostscript for piped input: gs -q -dSAFER 
> -dNOPAUSE -dBATCH -dCompatibilityLevel=1.5 -sDEVICE=pdfwrite 
> -sOutputFile=example-image-a-eps-converted-to.pdf 
> -dPDFSETTINGS#/prepress -dMaxSubsetPct=100 -dSubsetFonts=true 
> -dEmbedAllFonts=true -dAutoRotatePages#/None - -c quit
> system returned with code 512
> from a pdfLaTeX run. Trying the same at the Terminal is fine.
> Amy idea what's up?

Am I correct in assuming that `which gs` prints something like 
/usr/local/bin/gs (in any case a path that is not /usr/bin)?

Am I further correct in assuming that defining and running a typesetting 
tool that runs the command `env` prints (among others) the variable 
"PATH" which does not contain the path to ghostscript?

In that case, it's the old problem of macOS not providing GUI 
applications (such as TeXworks) with the same environment variables as 
terminal applications (in particular, .bashrc & friends don't seem to be 
parsed for GUI applications). See also 

If that is the case, I don't see a really good solution, unfortunately. 
Some options include
*) Requiring the user to install programs in "standard directories" or 
alongside the tex binaries
*) Requiring some wrapper scripts that parse .bashrc & friends and amend 
the environment for each typesetting tool
*) Provide a way (e.g., editable list) in TeXworks for users to add 
custom paths to add to $PATH (or potentially other environment variables 
as well) whenever a typesetting tool is run

Unfortunately, each of these options require some (fairly advanced) 
input from the user just to run standard processes - which is not ideal, 
of course.


More information about the texworks mailing list.