MacOS – How to fix things when LaTex issues a package minted error for “Pygments” or pigmentize

latexmacospythonterminal

I am trying to install the "Pygments" package to Python via terminal on my Mac so that I can utilize the "minted" package in Latex.

I have downloaded the package via the terminal by using the following code:

curl https://bootstrap.pypa.io/get-pip.py > get-pip.py

followed by:

sudo python get-pip.py

and then

sudo pip install pygments

It took a couple tries of repeating the same commands but it finally successfully installed. I don't know what to do now though. I'm still getting the same error from LaTex:

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

Does anyone have any experience with this issue and could possibly provide some assistance?

Best Answer

  1. First, Locate the folder where pygmentize is saved

    $ which pygmentize 
    /Users/ggautier/anaconda/bin/pygmentize
    
  2. Add the path i.e. /Users/ggautier/anaconda/bin in the "texpath" field


// Platform settings: adapt as needed for your machine
// ------------------------------------------------------------------

 "osx":  {
  // Path used when invoking tex & friends; MUST include $PATH
  "texpath" : "$PATH:/Users/ggautier/anaconda/bin:/Library/TeX/texbin:/usr/texbin:/usr/local/bin:/opt/local/bin:"
  // Path to PDF viewer, if needed
  // TODO think about it. Also, maybe configure it here!
 }