I get multiple undefined control sequences when using the package minted and I believe it is caused by pygmentize.


I use the software Texpad and the active LaTeX distribution is set to:

  • /usr/local/texlive/2016/bin/x86_64-darwin

I then check both python and pygmentize:

  • which python results in /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
  • which pygmentize results in /opt/local/bin/pygmentize

I have MacPorts installed and I check the active version by using:

  • port select --list python which results in python34 (active)

Question 1

This is where I get confused, shouldn't which python also point to /opt/local/bin/python?


I check my paths by doing nano ~/.bash_profile, which results in:

export PATH=/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH
export PATH=/usr/local/texlive/2016/bin/x86_64-darwin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/:$PATH

# Your previous /Users/Batman/.bash_profile file was backed up as /Users/Batman/.bash_profile.macports-saved_$

# MacPorts Installer addition on 2017-02-12_at_00:07:31: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

Question 2

What is required given the above information in order for pygmentize to work?

Minimal Working Example (MWE):




    try {
        // Connect to SQL database
        $dsn = new PDO('mysql:host=servername;dbname=databasename', 'username', 'password');
    catch (PDOException $e) {
        // Prints out error message
        echo 'Error: ' . $e->getMessage();

2 Answers 2


So after some searching I found the answer here:


and the solution was:


If the errors continue one might try:


The issue seems to be with the minted package and not associated with pygmentize.


The pygmentize issue can be addressed by installing pygments with pip2.

sudo pip2 install pygments

This method works on my cases.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .