I was unable to test any of the solutions provided, as I changed my main system last year. After that, no more problems arose. I suspect the old system had problems with the hard drive. Either that or the operating system was failing.

I'm using minted along with XeLaTeX, but recently I've run into strange problems. To illustrate what I mean, consider the following MWE (the filename is main.tex):



        #include <stdio.h>
        int main() {
            printf("Hello World!\n");
            return 0;

Compiling it with pdflatex --shell-escape generates the document correctly. Not so with xelatex --shell-escape, which outputs the following error:

! Package catchfile Error: File `main.w18' not found.

See the catchfile package documentation for explanation.
Type  H <return>  for immediate help.

l.93     \CatchFileDef\@tempa{\ip@file}{}

Am I missing something specific to XeLaTeX that makes minted work as expected?

Thanks in advance!

EDIT: I have discovered that logging out or rebooting the computer temporarily solves the problem. I attach general information about the system I'm currently using and the log here for more details:

This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015) (preloaded format=xelatex 2015.8.10)  22 SEP 2015 19:01
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
LaTeX2e <2015/01/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2015/texmf-dist/tex/latex/minted/minted.sty
Package: minted 2015/09/09 v2.1 Yet another Pygments shim for LaTeX

Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)

Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)

Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)

Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
Package: fancyvrb 2008/02/07

Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)
Package: float 2001/11/08 v1.3d Float enhancements (AL)
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
Package: calc 2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
Package: ifplatform 2010/10/22 v0.4 Testing for the operating system

Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO

Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is not detected.
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: pdfTeX >= 1.30 not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode not found.
Package: catchfile 2011/03/01 v1.6 Catch the contents of a file (HO)
runsystem(uname -s > "proba.w18")...executed.

! Package catchfile Error: File `proba.w18' not found.

See the catchfile package documentation for explanation.
Type  H <return>  for immediate help.

l.93     \CatchFileDef\@tempa{\ip@file}{}

? x

Here is how much of TeX's memory you used:
 1071 strings out of 493708
 17078 string characters out of 6145891
 71205 words of memory out of 5000000
 4449 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 1328 hyphenation exceptions out of 8191
 37i,0n,19p,243b,18s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
  • Xubuntu 15.04
  • TeXLive 2015
  • minted 2.1

EDIT 2: I could trick xelatex into thinking main.w18 had been created by executing uname -s > main.w18 beforehand. However, this new error appears:

! Package minted Error: You must have `pygmentize' installed to use this package.

Of course, I have pygmentize installed, as I can compile sometimes.

EDIT 3: After fiddling around, it seems XeLaTeX is unable to write files to the filesystem. I tried reinstalling TeXLive with no luck.

closed as unclear what you're asking by egreg, CarLaTeX, Troy, TeXnician, Zarko Jul 1 '17 at 7:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Adding information about your operating system, TeX installation, and version of minted, plus the complete log, might help. This is coming from ifplatform line 93 (83 in the docs, due to comments), which is using catchfile. Neither of those packages has been changed in years according to CTAN, and the recent releases of minted haven't changed anything that should affect those packages (minted just loads ifplatform to get \ifwindows). So this is strange. – G. Poore Sep 21 '15 at 2:11
  • Thanks for the feedback. I'm using Xubuntu 15.04, with TeXLive 2015 and minted 2.1. And about the log, as I started fiddling around, I deleted it and started from scratch again! I have some more information, though: only after rebooting my computer, this MWE started working as expected! Pretty strange, indeed. By the way, I'm having this annoying error once in a while, with no apparent reason. – logo_writer Sep 21 '15 at 5:11
  • I tried the example document with an Lubuntu 14.04 virtual machine with a completely updated TeX Live 2015, and couldn't get any errors. Tracking this down will probably be tricky. – G. Poore Sep 21 '15 at 16:30
  • 1
    It looks like uname is failing sometimes. I have no idea what would cause that. I've added ifplatform and catchfile to your question title. Maybe someone with more Linux knowledge will see that and have some ideas. – G. Poore Sep 23 '15 at 0:51
  • 1
    I tried a Xubuntu virtual machine and got no problem (but TeX Live is still 2014). The file <filename>.w18 is read in with no issue. – egreg Sep 23 '15 at 9:09

Add \usepackage{shellesc} in main.tex before \usepackage{minted}

  • 3
    A little more explanation would be nice. – Heiko Oberdiek Jul 5 '16 at 17:44
  • Thanks for answering! I'll check trying that and get back to you as soon as possible. A little more explanation, as @HeikoOberdiek said, would be nice, though. – logo_writer Jul 7 '16 at 1:29
  • Worked for me; I think it works because lualatex --shell-escape doesn't work anymore. – Ayberk Özgür Feb 19 '18 at 18:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.