Installed MacTex2023 on a new Mac and all is well except for a nagging issue with "pygmentize" that I've already installed. I cannot find how to adjust system to recognise the installed "pygmentize" that exists in my "/Users//Library/Python/3.9/bin" folder.
I have upgraded to Python 3.11 and used pip3 to confirm that Pygments 2.14.0 is installed.
I've already checked those SE pages that discuss Pygmentize issues, e.g. at Pygmentize not working properly with minted package in TexShop on OS X
Additional specs via 'pip3 list': Package Version
- altgraph 0.17.2
- future 0.18.2
- macholib 1.15.2
- pip 23.0.1
- Pygments 2.14.0
- setuptools 67.6.0
- six 1.15.0
- wheel 0.40.0
Note: When I run the following minimal LaTeX package, I see the same error:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
}
\end{minted}
\end{document}
e.g.: 'Package minted Error: You must have `pygmentize' installed to use this package.'
Note 2: I Typeset to LaTeX using TexShop.
-shell-escapeflag? That is necessary for the package to work. – Amarakon Mar 26 '23 at 04:39TeXShop preferences > Engine > pdfTeX > Latexfield I have the following command:pdflatex --file-line-error --synctex=1 --shell-escape, which I assume turns ON the-shell-escapeflag ... n'est pas? Is there something else I need to do? – RosesBouquet Mar 26 '23 at 04:47-shell-escapeflag issue took me a bit to research ... now I need to research a bit more to address the issue withpygmentize.... unless someone else has had the same issue, and a solution. Thanks for your comment! – RosesBouquet Mar 26 '23 at 05:47fontspec/fontencdifferences between the two), which generated the requiredmintedoutput. Then compile again with LuaLatex to get the final PDF. I am using TeXStudio/MikTeX (fully upgraded). Checking the pathways in both compilations revealed a strange issue: in LuaLatex the whole pathway was replaced with only one line pointing towards the MikTeX installation.... – alchemist Mar 26 '23 at 08:29pygmentizea few years back (even made notes in the code re the issue). Now with the new Mac, I'm back to square one. I've upgraded to MacTeX2023, so there are two variables at play. I'll likely have to stumble around for a bit before I stumble on a solution as I apparently did back then. All-in-all a small price to pay for the power of LaTeX ... hadn't thought aboutfontspec... don't know if/how relevant ... will have to check that! – RosesBouquet Mar 26 '23 at 09:16fontspecisn't relevant to thepygemtizeissue, only you use it to manage fonts in LuaLatex. – alchemist Mar 26 '23 at 11:01per documentwould be appreciated ... A special thanks again! – RosesBouquet Mar 26 '23 at 12:35% !TeXmagic comment feature at the top of the document to make such settings – David Carlisle Mar 26 '23 at 12:58pygmentize -Vto confirm it is correctly installed? – user691586 Mar 26 '23 at 13:30% !TeXand never could get it to activate shell-escape. Unfortunately https://stackoverflow.com/a/28586661 advises people to add permanently--shell-escapetopdflatexinvocation in TeXShop preferences. – user691586 Mar 26 '23 at 13:55ln -s "$(which pygmentize)" /Library/TeX/texbin/pygmentizefrom https://tex.stackexchange.com/a/281188/293669 works for me (I don't need sudo due to my custom way of installing TeXLive on my mac). But I still have no solution how to tell TeXShop to use--shell-escapeonly of one run. My advise: better to stop using TeXShop than to configure permanently with--shell-escape. – user691586 Mar 26 '23 at 14:05pdflatex --shell-escape documentname– David Carlisle Mar 26 '23 at 14:06--shell-escapein the default TeXShop pdflatex call and toggle on the "Shell Escape Warning" you will be warned about shell-escape. But the logic is moot. Much better if there was some toggle in the TeXShop window to turn on, exceptionally theshell escape. – user691586 Mar 26 '23 at 14:39--shell-escapebut rather with TeXShop being able to locatepygmentize. Open a Terminal and typeln -s ~/miniconda3/bin/pygmentize /usr/local/bin/pygmentize, replacing the first path with that appropriate for your setup, and hitreturn. You should then be able to process your document assuming you enable--shell-escapein any of the usual ways. I prefer to put% !TEX parameter = --shell-escapeat the top of my file. – LaTeXereXeTaL Mar 26 '23 at 17:40pygmentize -Vthe response I get isPygments version 2.14.0, (c) 2006-2022 by Georg Brandl, Matthäus Chajdas and contributors.– RosesBouquet Apr 01 '23 at 16:38ln -s "$(which pygmentize)" /Library/TeX/texbin/pygmentizebusiness. cf my answer. Unfortunately it seems, at least for TeXShop of 5 or 6 years ago that you need to permanently add--shell-escapebut you have possibilty to toggle "warn if shell escape" (or whatever is wording) and you can deactivate for documents not needing it, on first compilation. – user691586 Apr 01 '23 at 16:44Omit Shell Escapemessage ... but if I select OK (to keep Shell Escape) ... something is not working ... I'll need some time to sort out ... Thank you for your assistance. – RosesBouquet Apr 01 '23 at 17:32minted alternative? (https://tex.stackexchange.com/questions/351454/how-to-you-properly-specify-an-alternative-to-the-pygmentize-external-command-fo – RosesBouquet Apr 01 '23 at 17:54ln -s "$(which pygmentize)" /Library/TeX/texbin/pygmentize, then in TeXShopPreferences>Engine(I assume in English) in thepdflatexinvocation I add--shell-escape, and also toggleShell escape warn(I see it in my locale language) but only because I want to have opportunity to deactivate shell-escape. Then I launch compilation, a pop-up appears asking if I really want to use shell-escape, I clickOKand it works. – user691586 Apr 01 '23 at 18:03pdflatexcunderMacros>Claus Gerhardt Macros, but I needed to run the script twice to obtain the complete output. (A bit strange?) Question: Does thepdflatexcscript set--shell-escapeON for just the immediate project, or for ALL projects. Thank you for this ... I will need to test thepdflatexcscript on my full project b4 accepting your answer ... Thank you for all your research!! – RosesBouquet Apr 01 '23 at 18:04pdflatexcis simplypdflatex --shell-escape. I.e. it only uses--shell-escapeonce, when called. It does not have any left-over effects. However personally I would not use it because I need to see the console output of LaTeX run for quick analysis in case of errors or warnings, and this window is not shown by TeXShop when one uses it. – user691586 Apr 01 '23 at 18:06pdflatexcscript console output appears blank ... until suddenly the finished PDF appears ... as you pointed out, would be nice to actually see the output of LaTeX run ... a small price to pay ... n'est pas? Thank you for confirming thatpdflatexconly uses--shell-escapeonce ... any thoughts as to why I needed to run thepdflatexctwice to get the full PDF output? Thanks again for all your research!! – RosesBouquet Apr 01 '23 at 18:11sudo ln -s "$(which pygmentize)" /Library/TeX/texbin/pygmentize, then in TeXShopPreferences>Enginein the pdflatex invocation I added--shell-escape, and also toggled the Shell escape warning ON ... Thank you again for all your research!! – RosesBouquet Apr 01 '23 at 18:16which pygmentizeworks! – RosesBouquet Apr 01 '23 at 18:22are you sure you want --shell-ecape on in your default settings rather than enabled per document?, where may I research what--shell-escapereally means ... andYou are giving the author of that code full access to your machine.... that is certainly NOT something I wish to do ... Thanks again for ALL your comments and assistance! – RosesBouquet Apr 01 '23 at 19:22\write18{arbitrary commands}so anything you can do on the command line could happen, All your files could be deleted, your ssh private keys could be emailed to me, or the tex file could process normally and a pdf gets made. – David Carlisle Apr 01 '23 at 19:44--shell-escapeissue. Recent documents (which I cannot locate at the moment) call for avoiding the use of--shell-escapein MacTeX 2023. I've realized that bypassing the many protections built into TeX and LaTeX was a risky endeavor, but the nail in the coffin was my realization that my project ran just fine w/o the Minted package, which was the reason why I was attempting to implement the--shell-escapefeature all along. – RosesBouquet Apr 02 '23 at 02:32--shell-escapein my TeXShop for now, while typesetting w/o--shell-escape, with the intent to delete it from my TeXShop setup once I've had enough experience with my projects running w/o the--shell-escapefunction. Thank you David Carlisle for pointing this out from the get-go when I originally posted on SE ... your points about having complete access to my system bothered me for the better part of a week ... with the clincher being thatyour ssh private keys could be emailed to me. 'nuf said. Thank you!! – RosesBouquet Apr 02 '23 at 02:38mintedand--shell-escape. I've tried setting themintedoption todraft=true, but the glossaries still fail unless I include--shell-escape. Seems I've been running withmintedand--shell-escapefor so long that I've forgotten how to create the glossaries w/o them. I've tried searching for combinations ofminted,--shell-escapeandglossariesbut have found nothing relevant to the issue. What am I missing? – RosesBouquet Apr 05 '23 at 08:20mintedand--shell-escapehave to do withglossaries? – RosesBouquet Apr 05 '23 at 08:25minted is completely unrelated.- Just what I thought ... Not usingwrite18that I know of ... I've never heard ofwrite18b4 your mentioning it ... Best I can tell there is nothing out of the ordinary with my glossaries that I'm using ... but let me research this a bit more and advise as to what I can see ... It all seems a bit odd ... In the meantime, I've removed all mention of--shell-escapefrom my projects ... Many thanks for the advice and feedback! – RosesBouquet Apr 05 '23 at 10:20