How to invoke latex with the -shell-escape flag in TeXStudio (former TeXMakerX)?

First of all, TeXMakerX is now TeXStudio. If you are still running TeXMakerX then it is advised that you upgrade to the latest version of TeXStudio.

minted uses Pygments of Python for the fancy coloring schemes. You need to invoke the -shell-escape option in order for LaTeX to allow Pygments to be used.

In TeXStudio, click on the following menu

Options > Configure TeXStudio > Commands

and change

pdflatex -synctex=1 -interaction=nonstopmode %.tex

into

pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

Edit

As mentioned by tohecz in comment, it is better to make a separate command for this in TeXStudio for security reasons. You can do this by clicking

Options > Configure TeXStudio > Build

and in the User Commands box, click +Add button and add a name for your command in the first cell, say user:graphviz-pdflatex and the command txs:///pdflatex/[--shell-escape] in the second cell.

enter image description here

You can then see the command listed in the menu

Tools > User

enter image description here Click on the command to run.


TeXstudio also provides a way for documents to define their own build commands directly with "magic" comments.

So you can set the "compile" command to pdflatex augmented with the shell-escape option by including the following comment in the document:

% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]

Or override the entire "pdflatex" command (which is not recommended as it also removes the path information) with

% !TeX TXS-program:pdflatex = pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

Another way of doing this, but on a per-document basis, is to use arara, which is a tool for automating compilation of (La)TeX files. arara is part of TeX Live 2012, but if you use MikTeX you have to install it manually.

To set up TeXStudio, add a new User command, as described in hpesoj626's answer, with the command

arara %.tex

In your document you have to add one or more rules defining which commands to run, as "magic" comments at the start of the file. To compile with pdflatex and shell escape enabled, add

% arara: pdflatex: {shell: true}

at the beginning of your .tex file, and compile with the user command you just created.