TeXworks doesn't set correctly the PATH on macOS #861
Comments
|
This seems to be a "feature" of Mac OS. Does https://superuser.com/questions/476752/setting-environment-variables-in-os-x-for-gui-applications help? |
|
I saw the new version 0.6.4. The malfunctioning has not been fixed. I repeat: version 0.6.2 executes shell commands without any problem on macOS 10.15 Catalina. So it is not a macOS feature. |
|
As far as I can tell, there was no change to the source code in TeXworks. 0.6.2 uses It does generally seem to be a Mac OS "feature" (i.e. intended behavior) that GUI apps are treated differently than terminal apps (both Google and StackExchange have many hits for this topic, and there is even a dedicated script intended to try mitigate this), and things seem to change from version of version of Mac OS X. From what I can tell (without having a Mac to test on), GUI apps are launched by some About TeXworks 0.6.2. After a lot of digging, I seem to have found a difference in how Qt, the underlying framework used by TeXworks, handles environment variables. Tw 0.6.2 uses a version of Qt somewhere around 5.8.0, whereas Tw 0.6.3 uses Qt somewhere around 5.12.1 (could you verify that from Help > About TeXworks please?). Qt 5.8.0 uses the |
|
As documented, e.g., in QTBUG-42656, an application launched from the GUI has different environmental variable settings than if launched from a terminal. Presumably, the reason is that the application inherits the environment of the calling process. If this is the terminal (e.g., bash), it will have parsed all sorts of config files (e.g., ( BTW, the same happens on Linux. You can try redefining the typesetting tool to not run pdftex directly but rather a shell and pdftex in that shell. Maybe that would force the config files to be parsed... Also note that Tw does not (directly) use $PATH. Instead, it keeps its own list of directories in which to look for TeX-related programs. By default, the directories in $PATH are added to the list, but you can also add your own (and they will have a higher priority than the auto-added ones). Thus, you could in principle have several side-by-side installations of TeX and quickly change between them by simply reordering the list. Because it keeps its own list, Tw does not rely on $PATH when executing programs but instead calls them with their full path. For all these reasons, I currently see no way to easily implement what you want. TeXworks can only rely on the environment it gets during invocation - any custom parsing of config files is bound to break sooner or later; and forcefully messing with environment variables would probably break stuff, too. |
Steps to reproduce the problem:
Run a file
\input|"kpsewhich plain.tex"\byewith pdftex from the menuExpected output:
/usr/local/texlive/2019/texmf-dist/tex/plain/base/plain.tex
Actual output:
Nothing. The console shows
TeXworks version: 0.6.3
TeXworks obtained from: GitHub
Operating system: macOS Mojave 10.14
Please provide any additional information below:
If I define a “pdftex+shell-escape" engine and run a file containing
I get in the PDF file
/usr/bin:/bin:/usr/sbin:/sbin.If I launch TeXworks from a terminal with
the
PATHvariable is set correctly.The text was updated successfully, but these errors were encountered: